Skip to content

Commit 68b113a

Browse files
committed
fix: tests
1 parent 566d5d7 commit 68b113a

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

packages/stream-model-instance-handler/src/__tests__/model-instance-document-handler.test.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import {
2626
FAKE_CID_3,
2727
FAKE_CID_4,
2828
JWS_VERSION_1,
29-
NO_DID_SIGNER,
3029
RotatingSigner,
3130
} from '@ceramicnetwork/did-test-utils'
3231
import { CommonTestUtils as TestUtils } from '@ceramicnetwork/common-test-utils'
@@ -431,7 +430,7 @@ describe('ModelInstanceDocumentHandler', () => {
431430
}
432431
// stringify as a way of doing deep copy
433432
const clone = cloneDeep(rec)
434-
const c = hash(JSON.stringify(clone))
433+
const c = DidTestUtils.hash(JSON.stringify(clone))
435434
recs[c.toString()] = { value: clone }
436435
return c
437436
},
@@ -788,7 +787,7 @@ describe('ModelInstanceDocumentHandler', () => {
788787
const doc = new ModelInstanceDocument(state$, context)
789788

790789
await expect(
791-
ModelInstanceDocument.makeUpdateCommit(NO_DID_SIGNER, doc.commitId, doc.content, CONTENT1)
790+
ModelInstanceDocument.makeUpdateCommit(CeramicSigner.invalid(), doc.commitId, doc.content, CONTENT1)
792791
).rejects.toThrow(/No DID/)
793792

794793
const commit = (await ModelInstanceDocument.makeUpdateCommit(
@@ -949,8 +948,8 @@ describe('ModelInstanceDocumentHandler', () => {
949948
envelope: signedCommit.jws,
950949
}
951950
// MID can't be updated with content that does not pass schema validation
952-
await expect(handler.applyCommit(signedCommitData, context, state)).rejects.toThrow(
953-
'Validation Error: data/one must NOT have fewer than 2 characters, data/two must NOT have fewer than 2 characters'
951+
await expect(handler.applyCommit(signedCommitData, context, state)).rejects.toMatch(
952+
'data/one must NOT have fewer than 2 characters, data/two must NOT have fewer than 2 characters'
954953
)
955954
})
956955

@@ -1198,7 +1197,7 @@ describe('ModelInstanceDocumentHandler', () => {
11981197
envelope: commit.jws,
11991198
}
12001199

1201-
await expect(handler.applyCommit(commitData, context)).rejects.toThrow(
1200+
await expect(handler.applyCommit(commitData, context)).rejects.toMatch(
12021201
/data must have required property 'myData'/
12031202
)
12041203
})
@@ -1252,7 +1251,7 @@ describe('ModelInstanceDocumentHandler', () => {
12521251
envelope: signedCommit.jws,
12531252
}
12541253

1255-
await expect(handler.applyCommit(signedCommitData, context, state)).rejects.toThrow(
1254+
await expect(handler.applyCommit(signedCommitData, context, state)).rejects.toMatch(
12561255
/data must have required property 'myData'/
12571256
)
12581257
})

0 commit comments

Comments
 (0)