From 453251046fb17d75a78c551f25199ea6a62ebb0f Mon Sep 17 00:00:00 2001 From: Agnes Lin Date: Wed, 13 Nov 2019 11:36:49 -0500 Subject: [PATCH] test(repository-tests): modify replace-by-id tests for cloudant --- .../src/crud/replace-by-id.suite.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/repository-tests/src/crud/replace-by-id.suite.ts b/packages/repository-tests/src/crud/replace-by-id.suite.ts index 3bf0d64ec5f3..ac13cecc30fa 100644 --- a/packages/repository-tests/src/crud/replace-by-id.suite.ts +++ b/packages/repository-tests/src/crud/replace-by-id.suite.ts @@ -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; @@ -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', @@ -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',