Add a test to verify PersistedModel updateAll

Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
This commit is contained in:
Miroslav Bajtoš 2019-10-03 10:52:33 +02:00
parent 4ff55feb24
commit 39771be12f
No known key found for this signature in database
GPG Key ID: 6F2304BA9361C7E3
2 changed files with 14 additions and 1 deletions

View File

@ -32,7 +32,7 @@
"homepage": "http://loopback.io",
"dependencies": {
"loopback-datasource-juggler": "^3.0.0",
"strong-remoting": "^3.0.0"
"strong-remoting": "^3.15.0"
},
"devDependencies": {
"assert": "^1.4.1",

View File

@ -373,4 +373,17 @@ describe('Remote model tests', function() {
});
}
});
describe('Model.updateAll([where], [data])', () => {
it('returns the count of updated instances in data source', async () => {
await ServerModel.create({first: 'baby', age: 1});
await ServerModel.create({first: 'grandma', age: 80});
const result = await ClientModel.updateAll(
{age: {lt: 6}},
{last: 'young'},
);
assert.deepEqual(result, {count: 1});
});
});
});