Skip to content

Commit

Permalink
Merge branch 'hyperledger:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
duckling69 committed Jun 11, 2024
2 parents f41f0b9 + 8ec4e00 commit 6ac41bd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/caliper-core/test/common/core/messages/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,13 @@ describe('Message', () => {

it("should set the current date if the date is not provided", () => {
const message = new Message(mockSender, mockRecipients, mockType, mockContent);
const firstDate = new Date();
const stringifiedMessage = message.stringify();
const decodedMessage = JSON.parse(stringifiedMessage);

decodedMessage.date.should.equal(new Date().toISOString());
const secondDate = new Date(decodedMessage.date);
const millisecondDifference = secondDate - firstDate;
// allow for upto 5 second discrepancy
chai.assert(millisecondDifference < 5 * 1000);
})
})
})

0 comments on commit 6ac41bd

Please sign in to comment.