Skip to content

Commit

Permalink
test: fix setEmailExpired relative test
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasCharrier committed Nov 21, 2024
1 parent dfa7889 commit a8957bb
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions __tests__/test-user-contract-ending.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,7 @@ describe("After quitting", () => {
should.equal(test.length, 2);
});

it("should set email as expired", async () => {
const today = new Date(fakeTodayDate);

it("should set email as expired if email is not from main domain", async () => {
const updatedUser = await db
.updateTable("users")
.where("username", "=", "julien.dauphant")
Expand All @@ -436,7 +434,23 @@ describe("After quitting", () => {
.selectAll()
.where("username", "=", "julien.dauphant")
.execute();
user.primary_email_status.should.equal(EmailStatusCode.EMAIL_EXPIRED);
user.primary_email_status.should.equal(EmailStatusCode.EMAIL_SUSPENDED);

const updatedUser2 = await db
.updateTable("users")
.where("username", "=", "julien.dauphant")
.set({
primary_email: `[email protected]`,
})
.returningAll()
.executeTakeFirstOrThrow();
await setEmailExpired();
const [user2] = await db
.selectFrom("users")
.selectAll()
.where("username", "=", "julien.dauphant")
.execute();
user2.primary_email_status.should.equal(EmailStatusCode.EMAIL_EXPIRED);
// userinfos.restore();
});

Expand Down

0 comments on commit a8957bb

Please sign in to comment.