Giter VIP home page Giter VIP logo

cloud-native-todo's Introduction

Hi there πŸ‘‹, my name is Dina

I'm a developer experience content lead at Microsoft

Dina is a Developer Experience content lead at Microsoft covering JS and PY. Having spent 15 years doing web development, she’s seen it all. ASP -> C# -> JavaScript -> TypeScript. Always learning something new in the web + database space including process improvements such as dev containers, CICD automation pipelines and GraphQL. When not sitting at a computer she can be found cycling around town.

  • πŸ”­ I’m currently working making the cloud easier to use for developers
  • πŸ“„ I write a lot for Microsoft as diberry including many Azure samples repos
  • πŸ“„ I write also write for myself: latest at dfberry.github.io, archive at 31a.
  • πŸ“£ I ask a lot of questions
  • πŸ˜„ Pronouns: she/her

cloud-native-todo's People

Contributors

dfberry avatar seesharprun avatar

Watchers

 avatar  avatar

Forkers

seesharprun

cloud-native-todo's Issues

006-related - API test fails

both locally and in CICD on 006-branch finds 1 item when default is 3

test runs from workspace, fails without workspace


> [email protected] pretest
> jest --clearCache npm run lint:fix && npm run build && npm run postbuild

Cleared /tmp/jest_0

> [email protected] build
> tsc


> [email protected] postbuild
> ncp ./src/openapi.yaml ./dist/openapi.yaml


> [email protected] postbuild
> ncp ./src/openapi.yaml ./dist/openapi.yaml


> [email protected] test
> cross-env NODE_ENV=test jest --runInBand --no-cache --detectOpenHandles --forceExit --coverage

 FAIL  src/server.test.ts
  todo
    GET /todo
      βœ• responds with json (41 ms)
    POST /todo
      βœ• responds with the posted todo (24 ms)
      βœ• responds with the error (7 ms)
      βœ• responds with the error when title has over 1000k (12 ms)
      βœ• responds with the error when Todo has extra properties (8 ms)
    PUT /todo/:id
      βœ• updates the todo with the given id (6 ms)
      βœ• responds with the error when malformed Todo (9 ms)
      βœ• responds with the error when id not found (7 ms)
      βœ• responds with the error when Todo has extra properties (13 ms)
      βœ• responds with the error when title has over 1000k (9 ms)
    DELETE /todo/:id
      βœ• deletes the todo with the given id (7 ms)
      βœ• responds with the error when malformed id (8 ms)
      βœ• responds with the error when id not found (6 ms)

  ● todo β€Ί GET /todo β€Ί responds with json

    expect(received).toBe(expected) // Object.is equality

    Expected: 200
    Received: 500

      20 |     it('responds with json', async () => {
      21 |       const response = await request(app).get('/todo');
    > 22 |       expect(response.statusCode).toBe(StatusCodes.OK);
         |                                   ^
      23 |       expect(response.body).toEqual(
      24 |         expect.arrayContaining([
      25 |           expect.objectContaining({

      at src/server.test.ts:22:35
      at fulfilled (src/server.test.ts:5:58)

  ● todo β€Ί POST /todo β€Ί responds with the posted todo

    expect(received).toEqual(expected) // deep equality

    - Expected  - 4
    + Received  + 1

    - ObjectContaining {
    -   "id": Any<Number>,
    -   "title": "Test Todo",
    - }
    + Object {}

      37 |       const response = await request(app).post('/todo').send(todo);
      38 |
    > 39 |       expect(response.body).toEqual(
         |                             ^
      40 |         expect.objectContaining({
      41 |           id: expect.any(Number),
      42 |           title: 'Test Todo',

      at src/server.test.ts:39:29
      at fulfilled (src/server.test.ts:5:58)

  ● todo β€Ί POST /todo β€Ί responds with the error

    expect(received).toEqual(expected) // deep equality

    - Expected  - 3
    + Received  + 1

    - ObjectContaining {
    -   "error": "Invalid todo",
    - }
    + Object {}

      49 |       const response = await request(app).post('/todo').send(todo);
      50 |
    > 51 |       expect(response.body).toEqual(
         |                             ^
      52 |         expect.objectContaining(INVALID_TODO_ERROR)
      53 |       );
      54 |       expect(response.statusCode).toBe(StatusCodes.BAD_REQUEST);

      at src/server.test.ts:51:29
      at fulfilled (src/server.test.ts:5:58)

  ● todo β€Ί POST /todo β€Ί responds with the error when title has over 1000k

    expect(received).toEqual(expected) // deep equality

    - Expected  - 3
    + Received  + 1

    - ObjectContaining {
    -   "error": "Invalid todo",
    - }
    + Object {}

      58 |       const response = await request(app).post('/todo').send(todo);
      59 |
    > 60 |       expect(response.body).toEqual(
         |                             ^
      61 |         expect.objectContaining(INVALID_TODO_ERROR)
      62 |       );
      63 |       expect(response.statusCode).toBe(StatusCodes.BAD_REQUEST);

      at src/server.test.ts:60:29
      at fulfilled (src/server.test.ts:5:58)

  ● todo β€Ί POST /todo β€Ί responds with the error when Todo has extra properties

    expect(received).toEqual(expected) // deep equality

    - Expected  - 3
    + Received  + 1

    - ObjectContaining {
    -   "error": "Invalid todo",
    - }
    + Object {}

      68 |       const response = await request(app).post('/todo').send(todo);
      69 |
    > 70 |       expect(response.body).toEqual(
         |                             ^
      71 |         expect.objectContaining(INVALID_TODO_ERROR)
      72 |       );
      73 |       expect(response.statusCode).toBe(StatusCodes.BAD_REQUEST);

      at src/server.test.ts:70:29
      at fulfilled (src/server.test.ts:5:58)

  ● todo β€Ί PUT /todo/:id β€Ί updates the todo with the given id

    expect(received).toBe(expected) // Object.is equality

    Expected: 202
    Received: 500

      87 |
      88 |       const response = await request(app).put('/todo/1').send(todo);
    > 89 |       expect(response.statusCode).toBe(StatusCodes.ACCEPTED);
         |                                   ^
      90 |       expect(response.body).toEqual(
      91 |         expect.objectContaining({
      92 |           // partial match of title string

      at src/server.test.ts:89:35
      at fulfilled (src/server.test.ts:5:58)

  ● todo β€Ί PUT /todo/:id β€Ί responds with the error when malformed Todo

    expect(received).toEqual(expected) // deep equality

    - Expected  - 3
    + Received  + 1

    - ObjectContaining {
    -   "error": "Invalid todo",
    - }
    + Object {}

      100 |       const response = await request(app).put('/todo/2').send(todo);
      101 |
    > 102 |       expect(response.body).toEqual(
          |                             ^
      103 |         expect.objectContaining(INVALID_TODO_ERROR)
      104 |       );
      105 |       expect(response.statusCode).toBe(StatusCodes.BAD_REQUEST);

      at src/server.test.ts:102:29
      at fulfilled (src/server.test.ts:5:58)

  ● todo β€Ί PUT /todo/:id β€Ί responds with the error when id not found

    expect(received).toEqual(expected) // deep equality

    - Expected  - 3
    + Received  + 1

    - ObjectContaining {
    -   "error": StringMatching /Todo not found/,
    - }
    + Object {}

      110 |       const response = await request(app).put('/todo/100').send(todo);
      111 |
    > 112 |       expect(response.body).toEqual(
          |                             ^
      113 |         expect.objectContaining(TODO_NOT_FOUND_ERROR)
      114 |       );
      115 |       expect(response.statusCode).toBe(StatusCodes.NOT_FOUND);

      at src/server.test.ts:112:29
      at fulfilled (src/server.test.ts:5:58)

  ● todo β€Ί PUT /todo/:id β€Ί responds with the error when Todo has extra properties

    expect(received).toEqual(expected) // deep equality

    - Expected  - 3
    + Received  + 1

    - ObjectContaining {
    -   "error": "Invalid todo",
    - }
    + Object {}

      120 |       const response = await request(app).put('/todo/2').send(todo);
      121 |
    > 122 |       expect(response.body).toEqual(
          |                             ^
      123 |         expect.objectContaining(INVALID_TODO_ERROR)
      124 |       );
      125 |       expect(response.statusCode).toBe(StatusCodes.BAD_REQUEST);

      at src/server.test.ts:122:29
      at fulfilled (src/server.test.ts:5:58)

  ● todo β€Ί PUT /todo/:id β€Ί responds with the error when title has over 1000k

    expect(received).toEqual(expected) // deep equality

    - Expected  - 3
    + Received  + 1

    - ObjectContaining {
    -   "error": "Invalid todo",
    - }
    + Object {}

      129 |       const response = await request(app).put('/todo/2').send(todo);
      130 |
    > 131 |       expect(response.body).toEqual(
          |                             ^
      132 |         expect.objectContaining(INVALID_TODO_ERROR)
      133 |       );
      134 |       expect(response.statusCode).toBe(StatusCodes.BAD_REQUEST);

      at src/server.test.ts:131:29
      at fulfilled (src/server.test.ts:5:58)

  ● todo β€Ί DELETE /todo/:id β€Ί deletes the todo with the given id

    expect(received).toEqual(expected) // deep equality

    - Expected  - 3
    + Received  + 1

    - ObjectContaining {
    -   "id": 1,
    - }
    + Object {}

      142 |     it('deletes the todo with the given id', async () => {
      143 |       const response = await request(app).delete('/todo/1');
    > 144 |       expect(response.body).toEqual(expect.objectContaining({ id: 1 }));
          |                             ^
      145 |       expect(response.statusCode).toBe(StatusCodes.ACCEPTED);
      146 |     });
      147 |     it('responds with the error when malformed id', async () => {

      at src/server.test.ts:144:29
      at fulfilled (src/server.test.ts:5:58)

  ● todo β€Ί DELETE /todo/:id β€Ί responds with the error when malformed id

    expect(received).toEqual(expected) // deep equality

    - Expected  - 3
    + Received  + 1

    - ObjectContaining {
    -   "error": "Invalid id",
    - }
    + Object {}

      148 |       const response = await request(app).delete('/todo/dog');
      149 |
    > 150 |       expect(response.body).toEqual(expect.objectContaining(INVALID_ID_ERROR));
          |                             ^
      151 |       expect(response.statusCode).toBe(StatusCodes.BAD_REQUEST);
      152 |     });
      153 |     it('responds with the error when id not found', async () => {

      at src/server.test.ts:150:29
      at fulfilled (src/server.test.ts:5:58)

  ● todo β€Ί DELETE /todo/:id β€Ί responds with the error when id not found

    expect(received).toEqual(expected) // deep equality

    - Expected  - 3
    + Received  + 1

    - ObjectContaining {
    -   "error": StringMatching /Todo not found/,
    - }
    + Object {}

      154 |       const response = await request(app).delete('/todo/100');
      155 |
    > 156 |       expect(response.body).toEqual(
          |                             ^
      157 |         expect.objectContaining(TODO_NOT_FOUND_ERROR)
      158 |       );
      159 |       expect(response.statusCode).toBe(StatusCodes.NOT_FOUND);

      at src/server.test.ts:156:29
      at fulfilled (src/server.test.ts:5:58)

-|---------|----------|---------|---------|-------------------
 | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
-|---------|----------|---------|---------|-------------------
 |   44.85 |        0 |    9.09 |   42.51 |                   
  |   52.83 |        0 |   14.28 |   51.92 |                   
   |      20 |        0 |       0 |   15.78 | 6-47              
   |   72.72 |        0 |      25 |   72.72 | 26,35,40-42,48-53 
  |   46.34 |        0 |    12.5 |   39.39 |                   
   |   46.34 |        0 |    12.5 |   39.39 | ...68,72-77,82-89 
  |      50 |      100 |       0 |      50 |                   
   |      50 |      100 |       0 |      50 | 6-7               
  |   31.57 |        0 |       0 |   31.57 |                   
   |   31.57 |        0 |       0 |   31.57 | 18-69             
-|---------|----------|---------|---------|-------------------
Test Suites: 1 failed, 1 total
Tests:       13 failed, 13 total
Snapshots:   0 total
Time:        3.153 s
Ran all test suites.
npm ERR! Lifecycle script `test` failed with error: 
npm ERR! Error: command failed 
npm ERR!   in workspace: [email protected] 
npm ERR!   at location: /workspaces/cloud-native-todo/api-todo 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.