Skip to content

Commit

Permalink
test(database-client): assert equality on method results, instead of …
Browse files Browse the repository at this point in the history
…method reference

also fix `getPassport retrieves the passport and stamps from ceramic` test to assert against
existingPassport date instead of today's date
  • Loading branch information
shavinac committed Jul 1, 2022
1 parent 5f9a9f7 commit 9505689
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions database-client/integration-tests/ceramicDatabaseTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ describe("when there is no passport for the given did", () => {
const formattedDate = new Date(storedPassport["issuanceDate"]);
const todaysDate = new Date();

expect(formattedDate.getDay).toEqual(todaysDate.getDay);
expect(formattedDate.getMonth).toEqual(todaysDate.getMonth);
expect(formattedDate.getFullYear).toEqual(todaysDate.getFullYear);
expect(formattedDate.getDay()).toEqual(todaysDate.getDay());
expect(formattedDate.getMonth()).toEqual(todaysDate.getMonth());
expect(formattedDate.getFullYear()).toEqual(todaysDate.getFullYear());
expect(storedPassport["stamps"]).toEqual([]);
});

Expand Down Expand Up @@ -200,12 +200,11 @@ describe("when there is an existing passport with stamps for the given did", ()
const actualPassport = await ceramicDatabase.getPassport() as Passport;

const formattedDate = new Date(actualPassport["issuanceDate"]);
const todaysDate = new Date();

expect(actualPassport).toBeDefined();
expect(formattedDate.getDay).toEqual(todaysDate.getDay);
expect(formattedDate.getMonth).toEqual(todaysDate.getMonth);
expect(formattedDate.getFullYear).toEqual(todaysDate.getFullYear);
expect(formattedDate.getDay()).toEqual(existingPassport.issuanceDate.getDay());
expect(formattedDate.getMonth()).toEqual(existingPassport.issuanceDate.getMonth());
expect(formattedDate.getFullYear()).toEqual(existingPassport.issuanceDate.getFullYear());
expect(actualPassport.stamps[0]).toEqual(ensStampFixture);
});

Expand Down

0 comments on commit 9505689

Please sign in to comment.