Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(repository-tests): test `replaceById`, verify plain data handling + more #3431

Merged
merged 3 commits into from Jul 26, 2019

Conversation

@bajtos
Copy link
Member

commented Jul 25, 2019

While working on the spike for Inclusion of related models (see #3387), I discovered that replaceById does not behave as expected when using MongoDB database and when implementing fromEntity repository method, extra care must be taken to not break MongoDB support.

In this pull request, I am adding new tests to verify that replaceById works correctly when called from JS/TS code (using a model instance as the data parameter) and via REST API (using a plain data object as the data parameter).

  • The first commit fixes a wrong import statement. While it's not directly related to my changes, I feel it's not worth opening a new PR for that.
  • The second commit introduces a new helper deleteAllModelsInDefaultDataSource that leverages the recently introduced juggler API (see strongloop/loopback-datasource-juggler#1759)
  • The third commits adds the new tests.

This pull request requires strongloop/loopback-datasource-juggler#1763 to be landed & published first. Before that happens, our test suite fails with console warnings that are detected & rejected by our test suite runner.

Checklist

馃憠 Read and sign the CLA (Contributor License Agreement) 馃憟

  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

馃憠 Check out how to submit a PR 馃憟

@bajtos bajtos added this to the July 2019 milestone milestone Jul 25, 2019

@bajtos bajtos requested review from raymondfeng, hacksparrow and b-admike Jul 25, 2019

@bajtos bajtos self-assigned this Jul 25, 2019

@raymondfeng

This comment has been minimized.

Copy link
Member

commented Jul 25, 2019

Please fix CI failures.

fix(repository-tests): refactor import referencing `src` from a diffe鈥
鈥ent package

Signed-off-by: Miroslav Bajto拧 <mbajtoss@gmail.com>

@bajtos bajtos force-pushed the feat/repository-tests-for-updates branch from 6c6edad to ea52f1b Jul 26, 2019

@bajtos

This comment has been minimized.

Copy link
Member Author

commented Jul 26, 2019

@raymondfeng

Please fix CI failures.

See the PR description:

This pull request requires strongloop/loopback-datasource-juggler#1763 to be landed & published first. Before that happens, our test suite fails with console warnings that are detected & rejected by our test suite runner.

I have published a new juggler version and landed #3438 to bring the new version to our deps. Let's see whether it fixes CI builds as expected.

bajtos added some commits Jul 25, 2019

refactor(repository-tests): introduce `deleteAllModelsInDefaultDataSo鈥
鈥rce`

Introduce a new helper to remove any models created by the previous
tests in the default datasource. By calling this helper from a `before`
hook, test suites can prevent conficts caused by the same model name
used by different model classes.

Signed-off-by: Miroslav Bajto拧 <mbajtoss@gmail.com>
feat(repository-tests): test `replaceById`, verify plain data handling
Signed-off-by: Miroslav Bajto拧 <mbajtoss@gmail.com>

@bajtos bajtos force-pushed the feat/repository-tests-for-updates branch from ea52f1b to 0b5a472 Jul 26, 2019

@bajtos bajtos merged commit 5791104 into master Jul 26, 2019

4 checks passed

clahub All contributors have signed the Contributor License Agreement.
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.03%) to 91.572%
Details

@delete-merged-branch delete-merged-branch bot deleted the feat/repository-tests-for-updates branch Jul 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can鈥檛 perform that action at this time.