Skip to content
This repository was archived by the owner on Dec 24, 2024. It is now read-only.

Test queue message array#14

Open
LucasBadico wants to merge 25 commits intokovihq:test-queue-message-arrayfrom
LucasBadico:test-queue-message-array
Open

Test queue message array#14
LucasBadico wants to merge 25 commits intokovihq:test-queue-message-arrayfrom
LucasBadico:test-queue-message-array

Conversation

@LucasBadico
Copy link

@LucasBadico LucasBadico commented Jul 27, 2019

Hey guys I have done the core function, I'm thinking about the performance of it. But I will face this after finish the hole setup.

I will expose two endpoints, one to supplie the queue with messages and another to read the processed message. The last one is the one that apply this core function, that I have created and also that has the rules proposed by you guys.

  • project scafolding
  • core function
  • orm
  • consumer
  • endpoints
  • ci-cd

I want to delivery this as close as possible with a production feature, ci, tests and design concerns being take into account.

@LucasBadico
Copy link
Author

Hey galera, meus pais se mudaram pra minha casa ontem, dai mexi muito pouco, to voltando agora, ainda hoje envio a versão final pra vcs.

@LucasBadico LucasBadico force-pushed the test-queue-message-array branch from 08c3b28 to 521f939 Compare July 28, 2019 23:31
@LucasBadico
Copy link
Author

LucasBadico commented Jul 29, 2019

Guys, finishing up.

endpoints
GET https://44zdgx0jc3.execute-api.us-east-1.amazonaws.com/dev/
POST https://44zdgx0jc3.execute-api.us-east-1.amazonaws.com/dev/
Content-Type: application/json
exemplo de body: [[1, 1, 2, 2], [1,2,3]]

@LucasBadico
Copy link
Author

test report

@spark/domain-messages@1.0.0 test /Users/badico/Repositories/hiring-tests
> jest --runInBand  "--silent"

 PASS  src/services/__tests__/saveMessageInput.spec.js
  saveMessageInput function
    ✓ should save a new message into database (1229ms)
    ✓ should return a already saved message  (981ms)
    ✓ should throw if a invalid input is suplied  (493ms)

 PASS  src/endpoints/__tests__/post.spec.js
  Post handler
    ✓ should return a message in data and status 202 (1153ms)
    ✓ should return a message in data and status 200 (966ms)
    ✓ should return a code, and errors with a invalid payload (474ms)

 PASS  src/orm/__tests__/orm.classes.spec.js
  ORM classes
    Classes constructors
      ✓ Model (1ms)
      ✓ MessageORM
      ✓ StatusHistoryORM (1ms)
    Classes intantiations
      ✓ Model
      ✓ MessageORM
      ✓ StatusHistoryORM
    Classes validations
      Model
        ✓ "input" must be a number (2ms)
        ✓ "output" must be a number (1ms)

 PASS  src/orm/__tests__/orm.methods.spec.js
  ORM methods
    MessageORM instance should have
      ✓ get method (1ms)
      ✓ set method (1ms)
      ✓ save method
      ✓ _save method (1ms)
      ✓ delete method
      ✓ update method
      ✓ validate method (1ms)
      ✓ addItem method
      ✓ removeItem method (1ms)
      ✓ updateItem method
    StatusHistoryORM instance should have
      ✓ get method
      ✓ set method (1ms)
      ✓ save method
      ✓ delete method (1ms)
      ✓ update method
      ✓ validate method (1ms)
      ✓ addItem method
      ✓ removeItem method
      ✓ updateItem method (1ms)
    Repository should have
      ✓ get method
      ✓ find method
    Message operations
      ✓ creating a message with input should also set the message id (1ms)
      ✓ saving a message should validate itself (2ms)
      ✓ changeStatus method should also add a statusHistory item in statusHistory

 PASS  src/services/__tests__/processMessage.spec.js
  processMessage function
    ✓ should return a array (2ms)
    ✓ should return unique items
    ✓ should return only the intersected items
    ✓ should the array be sorted

------------------------------|----------|----------|----------|----------|-------------------|
File                          |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
------------------------------|----------|----------|----------|----------|-------------------|
All files                     |    85.07 |    57.97 |    80.65 |    85.04 |                   |
 src                          |      100 |    66.67 |      100 |      100 |                   |
  config.js                   |      100 |    66.67 |      100 |      100 |               7,9 |
 src/endpoints                |      100 |      100 |      100 |      100 |                   |
  post.js                     |      100 |      100 |      100 |      100 |                   |
 src/helpers                  |    65.96 |    37.84 |    68.75 |    67.39 |                   |
  Presenter.class.js          |    58.97 |    37.84 |    64.29 |    60.53 |... ,90,96,102,103 |
  presenter.instance.js       |      100 |      100 |      100 |      100 |                   |
 src/ioc                      |      100 |      100 |      100 |      100 |                   |
  index.js                    |      100 |      100 |      100 |      100 |                   |
 src/models                   |    92.86 |       70 |      100 |    92.31 |                   |
  MessageORM.js               |      100 |    83.33 |      100 |      100 |                 8 |
  ModelWithStatus.abstract.js |       80 |       50 |      100 |       80 |                12 |
  StatusHistoryORM.js         |        0 |        0 |        0 |        0 |                   |
  index.js                    |        0 |        0 |        0 |        0 |                   |
 src/orm                      |      100 |      100 |      100 |      100 |                   |
  config.js                   |      100 |      100 |      100 |      100 |                   |
  index.js                    |      100 |      100 |      100 |      100 |                   |
 src/schemas                  |      100 |      100 |      100 |      100 |                   |
  MessageORM.js               |      100 |      100 |      100 |      100 |                   |
  StatusHistoryORM.js         |      100 |      100 |      100 |      100 |                   |
  index.js                    |        0 |        0 |        0 |        0 |                   |
 src/services                 |    86.36 |    83.33 |       80 |       85 |                   |
  processMessage.js           |      100 |      100 |      100 |      100 |                   |
  saveMessageInput.js         |    91.67 |       50 |      100 |    91.67 |                16 |
  showMessage.js              |       50 |      100 |        0 |       50 |               5,6 |
------------------------------|----------|----------|----------|----------|-------------------|

=============================== Coverage summary ===============================
Statements   : 85.07% ( 114/134 )
Branches     : 57.97% ( 40/69 )
Functions    : 80.65% ( 25/31 )
Lines        : 85.04% ( 108/127 )
================================================================================
Test Suites: 5 passed, 5 total
Tests:       42 passed, 42 total
Snapshots:   0 total
Time:        6.506s, estimated 7s

@LucasBadico
Copy link
Author

About ci, I haven't managed to do in time. Sending email to you guys.

@LucasBadico LucasBadico changed the title WIP: Test queue message array Test queue message array Jul 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant