Rewrite models - All models have been rewritten so that the model's functions receive dependencies as part of the function arguments. The abstraction for this is at models/model-lib.js.
Rewrite unit tests - Now that models use dependency injection, I was able to update the unit tests so that dependencies like the DB are mocked and passed to the function. Now the unit tests don't need a running DB.
Do you have any concerns with this PR?
Merging this PR will make the v2 branch similar to the v1 API, but without companies. Unit and API tests are passing. I haven't worked on the e2e tests yet. I just wanted to get this code in before switching contexts.
How can the reviewer verify this PR?
The PR is very large, but I would instead look at branch issue-321. The models, rest-server, and networkProtocols folders were the main areas of focus.
Any background context you want to provide?
I added jest for running unit tests because it's much easier to mock dependencies in Jest than Mocha. I plan to migrate the other tests to Jest.
Screenshots or logs (if appropriate)
Questions:
Have you connected this PR to the issue it resolves? #321
Does the documentation need an update? Will update docs prior to merging v2 into master.
Does this add new dependencies? jest
Have you added unit or functional tests for this PR? yes
What does this PR do?
models/model-lib.js
.Do you have any concerns with this PR?
Merging this PR will make the v2 branch similar to the v1 API, but without companies. Unit and API tests are passing. I haven't worked on the e2e tests yet. I just wanted to get this code in before switching contexts.
How can the reviewer verify this PR?
The PR is very large, but I would instead look at branch
issue-321
. Themodels
,rest-server
, andnetworkProtocols
folders were the main areas of focus.Any background context you want to provide?
I added
jest
for running unit tests because it's much easier to mock dependencies in Jest than Mocha. I plan to migrate the other tests to Jest.Screenshots or logs (if appropriate)
Questions:
jest