Skip to content

Commit

Permalink
Add field to current tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lmuntaner committed Dec 20, 2024
1 parent 1989438 commit 11acccb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/frontend/src/utils/iiConnection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ describe("Connection.login", () => {
expect(loginResult.kind).toBe("loginSuccess");
if (loginResult.kind === "loginSuccess") {
expect(loginResult.connection).toBeInstanceOf(AuthenticatedConnection);
expect(loginResult.showAddCurrentDevice).toBe(false);
expect(MultiWebAuthnIdentity.fromCredentials).toHaveBeenCalledTimes(1);
expect(MultiWebAuthnIdentity.fromCredentials).toHaveBeenCalledWith(
[convertToCredentialData(mockDevice)],
Expand Down Expand Up @@ -208,6 +209,7 @@ describe("Connection.login", () => {

expect(secondLoginResult.kind).toBe("loginSuccess");
if (secondLoginResult.kind === "loginSuccess") {
expect(secondLoginResult.showAddCurrentDevice).toBe(true);
expect(secondLoginResult.connection).toBeInstanceOf(
AuthenticatedConnection
);
Expand Down Expand Up @@ -258,6 +260,7 @@ describe("Connection.login", () => {

expect(secondLoginResult.kind).toBe("loginSuccess");
if (secondLoginResult.kind === "loginSuccess") {
expect(secondLoginResult.showAddCurrentDevice).toBe(false);
expect(secondLoginResult.connection).toBeInstanceOf(
AuthenticatedConnection
);
Expand Down Expand Up @@ -291,6 +294,7 @@ describe("Connection.login", () => {

expect(loginResult.kind).toBe("loginSuccess");
if (loginResult.kind === "loginSuccess") {
expect(loginResult.showAddCurrentDevice).toBe(false);
expect(loginResult.connection).toBeInstanceOf(AuthenticatedConnection);
expect(MultiWebAuthnIdentity.fromCredentials).toHaveBeenCalledTimes(1);
expect(MultiWebAuthnIdentity.fromCredentials).toHaveBeenCalledWith(
Expand Down Expand Up @@ -318,6 +322,7 @@ describe("Connection.login", () => {

expect(loginResult.kind).toBe("loginSuccess");
if (loginResult.kind === "loginSuccess") {
expect(loginResult.showAddCurrentDevice).toBe(false);
expect(loginResult.connection).toBeInstanceOf(AuthenticatedConnection);
expect(MultiWebAuthnIdentity.fromCredentials).toHaveBeenCalledTimes(1);
expect(MultiWebAuthnIdentity.fromCredentials).toHaveBeenCalledWith(
Expand Down Expand Up @@ -358,6 +363,7 @@ describe("Connection.login", () => {

expect(secondLoginResult.kind).toBe("loginSuccess");
if (secondLoginResult.kind === "loginSuccess") {
expect(secondLoginResult.showAddCurrentDevice).toBe(false);
expect(secondLoginResult.connection).toBeInstanceOf(
AuthenticatedConnection
);
Expand Down Expand Up @@ -391,6 +397,7 @@ describe("Connection.login", () => {

expect(loginResult.kind).toBe("loginSuccess");
if (loginResult.kind === "loginSuccess") {
expect(loginResult.showAddCurrentDevice).toBe(false);
expect(loginResult.connection).toBeInstanceOf(AuthenticatedConnection);
expect(MultiWebAuthnIdentity.fromCredentials).toHaveBeenCalledTimes(1);
expect(MultiWebAuthnIdentity.fromCredentials).toHaveBeenCalledWith(
Expand Down Expand Up @@ -419,6 +426,7 @@ describe("Connection.login", () => {
expect(loginResult.kind).toBe("loginSuccess");
if (loginResult.kind === "loginSuccess") {
expect(loginResult.connection).toBeInstanceOf(AuthenticatedConnection);
expect(loginResult.showAddCurrentDevice).toBe(false);
expect(MultiWebAuthnIdentity.fromCredentials).toHaveBeenCalledTimes(1);
expect(MultiWebAuthnIdentity.fromCredentials).toHaveBeenCalledWith(
[convertToCredentialData(mockDevice)],
Expand Down Expand Up @@ -461,6 +469,7 @@ describe("Connection.login", () => {
expect(secondLoginResult.connection).toBeInstanceOf(
AuthenticatedConnection
);
expect(secondLoginResult.showAddCurrentDevice).toBe(false);
expect(MultiWebAuthnIdentity.fromCredentials).toHaveBeenCalledTimes(2);
expect(MultiWebAuthnIdentity.fromCredentials).toHaveBeenNthCalledWith(
2,
Expand Down

0 comments on commit 11acccb

Please sign in to comment.