Skip to content

Commit

Permalink
test(repository-tests): modify replace-by-id tests for cloudant
Browse files Browse the repository at this point in the history
  • Loading branch information
Agnes Lin committed Nov 13, 2019
1 parent 46078bd commit 4532510
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/repository-tests/src/crud/replace-by-id.suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ export function createSuiteForReplaceById(
})
id: MixedIdType;

// cloudant needs this property to do replacement method
// see cloundant README file for more details
@property({type: 'string', generated: true})
_rev: string;

@property({type: 'string', required: true})
name: string;

Expand Down Expand Up @@ -71,7 +76,9 @@ export function createSuiteForReplaceById(
await repo.replaceById(created.id, created);

const found = await repo.findById(created.id);
expect(toJSON(found)).to.deepEqual(
// use containDeep instead of deepEqual because cloudant changes _rev value after
// replacement
expect(toJSON(found)).to.containDeep(
toJSON({
id: created.id,
name: 'new name',
Expand Down Expand Up @@ -100,7 +107,9 @@ export function createSuiteForReplaceById(
await repo.replaceById(created.id, created);

const found = await repo.findById(created.id);
expect(toJSON(found)).to.deepEqual(
// use containDeep instead of deepEqual because cloudant changes _rev value after
// replacement
expect(toJSON(found)).to.containDeep(
toJSON({
id: created.id,
name: 'new name',
Expand Down

0 comments on commit 4532510

Please sign in to comment.