Skip to content

Commit

Permalink
fix: Update adapter common tests to check for falsy (#1140)
Browse files Browse the repository at this point in the history
  • Loading branch information
daffl authored Dec 20, 2018
1 parent ae97020 commit 2856722
Show file tree
Hide file tree
Showing 2 changed files with 223 additions and 7 deletions.
12 changes: 6 additions & 6 deletions packages/adapter-commons/lib/tests/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = (test, app, errors, serviceName, idProp) => {
`${idProp} id property matches`
);
assert.strictEqual(data.name, 'Doug', 'data.name matches');
assert.strictEqual(data.age, undefined, 'data.age is undefined');
assert.ok(!data.age, 'data.age is falsy');
});

test('.get + id + query', async () => {
Expand Down Expand Up @@ -88,7 +88,7 @@ module.exports = (test, app, errors, serviceName, idProp) => {
});

assert.strictEqual(data.name, 'Doug', 'data.name matches');
assert.strictEqual(data.age, undefined, 'data.age is undefined');
assert.ok(!data.age, 'data.age is falsy');
});

test('.remove + id + query', async () => {
Expand Down Expand Up @@ -150,7 +150,7 @@ module.exports = (test, app, errors, serviceName, idProp) => {
`${idProp} id matches`
);
assert.strictEqual(data.name, 'Dougler', 'data.name matches');
assert.strictEqual(data.age, undefined, 'data.age is undefined');
assert.ok(!data.age, 'data.age is falsy');
});

test('.update + $select', async () => {
Expand All @@ -165,7 +165,7 @@ module.exports = (test, app, errors, serviceName, idProp) => {
});

assert.strictEqual(data.name, 'Dougler', 'data.name matches');
assert.strictEqual(data.age, undefined, 'data.age is undefined');
assert.ok(!data.age, 'data.age is falsy');
});

test('.update + id + query', async () => {
Expand Down Expand Up @@ -218,7 +218,7 @@ module.exports = (test, app, errors, serviceName, idProp) => {
});

assert.strictEqual(data.name, 'PatchDoug', 'data.name matches');
assert.strictEqual(data.age, undefined, 'data.age is undefined');
assert.ok(!data.age, 'data.age is falsy');
});

test('.patch + id + query', async () => {
Expand Down Expand Up @@ -344,7 +344,7 @@ module.exports = (test, app, errors, serviceName, idProp) => {
});

assert.strictEqual(data.name, 'William', 'data.name matches');
assert.strictEqual(data.age, undefined, 'data.age is undefined');
assert.ok(!data.age, 'data.age is falsy');

await service.remove(data[idProp]);
});
Expand Down
218 changes: 217 additions & 1 deletion packages/adapter-commons/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2856722

Please sign in to comment.