Skip to content

Commit

Permalink
Merge 5b10b03 into 7e3d8a5
Browse files Browse the repository at this point in the history
  • Loading branch information
kneth committed Nov 3, 2023
2 parents 7e3d8a5 + 5b10b03 commit 15ce736
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
10 changes: 10 additions & 0 deletions integration-tests/tests/src/tests/sync/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,16 @@ describe("App", () => {
expect(Object.keys(users).length).equals(nUsers);
});

it.only("double login", async function (this: Mocha.Context & AppContext & RealmContext) {
const credentials = Realm.Credentials.anonymous();
const user1 = await this.app.logIn(credentials);
const user2 = await this.app.logIn(credentials);
expect(user1.id).equals(user2.id);

await user2.logOut();
await user1.logOut();
});

it("currentUser works", async function (this: Mocha.Context & AppContext & RealmContext) {
expect(this.app.currentUser).to.be.null;

Expand Down
20 changes: 20 additions & 0 deletions integration-tests/tests/src/tests/sync/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,26 @@ describe.skipIf(environment.missingServer, "User", () => {
await user2.logOut();
});

it.only("double login", async function (this: AppContext & RealmContext) {
expect(this.app.currentUser, "No users").to.be.null;

const validEmail = randomVerifiableEmail();
const validPassword = "test1234567890";
await this.app.emailPasswordAuth.registerUser({ email: validEmail, password: validPassword });

const user1 = await this.app.logIn(
Realm.Credentials.emailPassword({ email: validEmail, password: validPassword }),
);

const user2 = await this.app.logIn(
Realm.Credentials.emailPassword({ email: validEmail, password: validPassword }),
);
expectIsSameUser(user1, user2);

await user2.logOut();
await user1.logOut();
});

it("can delete a user", async function (this: AppContext & RealmContext) {
expect(this.app.currentUser, "No users").to.be.null;

Expand Down

0 comments on commit 15ce736

Please sign in to comment.