Skip to content

Commit

Permalink
test(documents): delete document state's modifiedOn since it is now…
Browse files Browse the repository at this point in the history
… dynamtically generated
  • Loading branch information
benforshey committed Dec 13, 2024
1 parent a66f644 commit 9673146
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Object {
"publishedTo": Array [],
"states": Array [
Object {
"modifiedOn": "",
"source": "Init",
"target": "Draft",
},
Expand All @@ -43,7 +42,6 @@ Object {
"publishedTo": Array [],
"states": Array [
Object {
"modifiedOn": null,
"source": "Init",
"target": "Draft",
},
Expand Down
10 changes: 10 additions & 0 deletions packages/app/documents/__tests__/document.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ describe('Documents', () => {
//* Normalize by deleting properties that will always have a time-based fresh value.
delete firstInsertedAlert._id
delete firstInsertedAlert['x-meditor'].modifiedOn
//* Since change e3876fb4f226e6f0e84e24095e295dfea687089b we set the `modifiedOn` property of a document's root state.
firstInsertedAlert['x-meditor'].states.forEach(
stateEntry => delete stateEntry.modifiedOn
)

expect(firstInsertedAlert).toMatchSnapshot()
expect(await db.collection('Alerts').countDocuments()).toBe(11)

Expand All @@ -211,6 +216,11 @@ describe('Documents', () => {
//* Normalize by deleting properties that will always have a time-based fresh value.
delete secondInsertedAlert._id
delete secondInsertedAlert['x-meditor'].modifiedOn
//* Since change e3876fb4f226e6f0e84e24095e295dfea687089b we set the `modifiedOn` property of a document's root state.
secondInsertedAlert['x-meditor'].states.forEach(
stateEntry => delete stateEntry.modifiedOn
)

expect(secondInsertedAlert).toMatchSnapshot()
expect(await db.collection('Alerts').countDocuments()).toBe(
baselineCount + 2
Expand Down

0 comments on commit 9673146

Please sign in to comment.