Skip to content

Commit

Permalink
Merge branch 'andrew/refactor-email-password-test' of github.com:real…
Browse files Browse the repository at this point in the history
…m/realm-js into andrew/refactor-email-password-test
  • Loading branch information
kneth committed Sep 20, 2023
2 parents ba6f01f + 2287d88 commit bbe1ea9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions integration-tests/tests/src/tests/sync/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,18 @@ describe.skipIf(environment.missingServer, "User", () => {
await this.app.emailPasswordAuth.retryCustomConfirmation({ email: pendingEmail });
});

it("custom confirmation function rejects invalid email", async function (this: AppContext & RealmContext) {
const invalidEmail = randomNonVerifiableEmail();
const validPassword = "password123456";

const credentials = Realm.Credentials.emailPassword({ email: invalidEmail, password: validPassword });
await expect(this.app.logIn(credentials)).to.be.rejectedWith("invalid username/password"); // this user does not exist yet
expect(
this.app.emailPasswordAuth.registerUser({ email: invalidEmail, password: validPassword }),
).to.eventually.be.rejectedWith(`failed to confirm user "${invalidEmail}"`);
await expect(this.app.logIn(credentials)).to.be.rejectedWith("invalid username/password"); // this user did not register
});

it("reset password function works", async function (this: AppContext & RealmContext) {
const validEmail = randomVerifiableEmail();
const validPassword = "password123456";
Expand Down

0 comments on commit bbe1ea9

Please sign in to comment.