Skip to content

Commit ea2d990

Browse files
test(users): seed tokens before PII-leak assertion to make regression meaningful
The previous assertion would pass vacuously when resetPasswordToken and emailVerificationToken are absent on the user. Seed both fields via updateById before the admin GET so the test proves the leak is actually blocked, not just that the fields were never present. Addresses: #3731 (comment)...
1 parent 7f67d8d commit ea2d990

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

modules/users/tests/user.admin.integration.tests.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,18 @@ describe('User admin integration tests:', () => {
233233
expect(err).toBeFalsy();
234234
}
235235

236+
// Seed token fields so the regression test is meaningful — without this,
237+
// the assertions pass vacuously because the fields are simply absent.
238+
try {
239+
await UserService.updateById(userEdited._id, {
240+
resetPasswordToken: 'test-reset-token',
241+
emailVerificationToken: 'test-verification-token',
242+
});
243+
} catch (err) {
244+
console.log(err);
245+
expect(err).toBeFalsy();
246+
}
247+
236248
try {
237249
const result = await agent.get(`/api/admin/users/${userEdited._id}`).expect(200);
238250
expect(result.body.data).toBeInstanceOf(Object);

0 commit comments

Comments
 (0)