Skip to content

Commit

Permalink
test(api): for userRepository, add missing asserts on updatedAt
Browse files Browse the repository at this point in the history
  • Loading branch information
lego-technix authored Nov 19, 2024
1 parent 6044a14 commit b09edd6
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1400,6 +1400,7 @@ describe('Integration | Identity Access Management | Infrastructure | Repository
// then
expect(updatedUser).to.be.an.instanceOf(User);
expect(updatedUser.email).to.equal(newEmail);
expect(updatedUser.updatedAt).to.deep.equal(now);
});
});

Expand All @@ -1420,6 +1421,7 @@ describe('Integration | Identity Access Management | Infrastructure | Repository
// then
const user1 = await knex('users').where({ id: userId }).first();
expect(user1.emailConfirmedAt).to.deep.equal(now);
expect(user1.updatedAt).to.deep.equal(now);

const user2 = await knex('users').where({ id: user2Id }).first();
expect(user2.emailConfirmedAt).to.be.null;
Expand Down Expand Up @@ -1451,6 +1453,7 @@ describe('Integration | Identity Access Management | Infrastructure | Repository
expect(updatedUser.emailConfirmedAt.toString()).to.equal(userAttributes.emailConfirmedAt.toString());
expect(updatedUser.email).to.equal(userAttributes.email);
expect(updatedUser.cgu).to.equal(userAttributes.cgu);
expect(updatedUser.updatedAt).to.deep.equal(now);
});

it('should rollback the user email in case of error in transaction', async function () {
Expand Down Expand Up @@ -1593,6 +1596,7 @@ describe('Integration | Identity Access Management | Infrastructure | Repository
// then
expect(updatedUser).to.be.an.instanceOf(User);
expect(updatedUser.username).to.equal(username);
expect(updatedUser.updatedAt).to.deep.equal(now);
});

it('should throw UserNotFoundError when user id not found', async function () {
Expand Down Expand Up @@ -1638,6 +1642,7 @@ describe('Integration | Identity Access Management | Infrastructure | Repository

// then
expect(result.lastPixOrgaTermsOfServiceValidatedAt).to.deep.equal(now);
expect(result.updatedAt).to.deep.equal(now);
});
});

Expand Down Expand Up @@ -1668,6 +1673,7 @@ describe('Integration | Identity Access Management | Infrastructure | Repository

// then
expect(actualUser.lastPixCertifTermsOfServiceValidatedAt).to.deep.equal(now);
expect(actualUser.updatedAt).to.deep.equal(now);
});
});

Expand All @@ -1682,6 +1688,7 @@ describe('Integration | Identity Access Management | Infrastructure | Repository

// then
expect(actualUser.hasSeenAssessmentInstructions).to.be.true;
expect(actualUser.updatedAt).to.deep.equal(now);
});
});

Expand All @@ -1696,6 +1703,7 @@ describe('Integration | Identity Access Management | Infrastructure | Repository

// then
expect(actualUser.hasSeenNewDashboardInfo).to.be.true;
expect(actualUser.updatedAt).to.deep.equal(now);
});
});

Expand All @@ -1717,6 +1725,7 @@ describe('Integration | Identity Access Management | Infrastructure | Repository

// then
expect(actualUser.hasSeenFocusedChallengeTooltip).to.be.true;
expect(actualUser.updatedAt).to.deep.equal(now);
});

it('should return the model with hasSeenOtherChallengesTooltip flag updated to true', async function () {
Expand All @@ -1726,6 +1735,7 @@ describe('Integration | Identity Access Management | Infrastructure | Repository

// then
expect(actualUser.hasSeenOtherChallengesTooltip).to.be.true;
expect(actualUser.updatedAt).to.deep.equal(now);
});
});
});
Expand Down Expand Up @@ -1813,6 +1823,7 @@ describe('Integration | Identity Access Management | Infrastructure | Repository
expect(actualUser.lastTermsOfServiceValidatedAt).to.be.exist;
expect(actualUser.lastTermsOfServiceValidatedAt).to.be.a('Date');
expect(actualUser.mustValidateTermsOfService).to.be.false;
expect(actualUser.updatedAt).to.deep.equal(now);
});
});

Expand Down Expand Up @@ -1855,6 +1866,7 @@ describe('Integration | Identity Access Management | Infrastructure | Repository
// then
expect(result).to.be.an.instanceOf(User);
expect(result.lastDataProtectionPolicySeenAt).to.deep.equal(now);
expect(result.updatedAt).to.deep.equal(now);
});
});
});

0 comments on commit b09edd6

Please sign in to comment.