From 284859c21a8f4174cb5030ea21a064ea9ee16e2c Mon Sep 17 00:00:00 2001 From: peintnermax Date: Wed, 2 Aug 2023 15:21:34 +0200 Subject: [PATCH] lint, unit tests --- .../cypress/integration/register-idp.cy.ts | 4 +-- .../src/components/SignInWithGitlab.test.tsx | 8 ++++- .../src/components/SignInWithGoogle.test.tsx | 32 +++++++++++-------- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/apps/login/cypress/integration/register-idp.cy.ts b/apps/login/cypress/integration/register-idp.cy.ts index 5f1d2c9ca01..1cc0aaace53 100644 --- a/apps/login/cypress/integration/register-idp.cy.ts +++ b/apps/login/cypress/integration/register-idp.cy.ts @@ -14,8 +14,8 @@ describe("register idps", () => { it("should redirect the user to the correct url", () => { cy.visit("/register/idp"); cy.get('button[e2e="google"]').click(); - cy.origin(IDP_URL, ()=> { + cy.origin(IDP_URL, () => { cy.location("href", { timeout: 10_000 }).should("eq", IDP_URL); - }) + }); }); }); diff --git a/packages/zitadel-react/src/components/SignInWithGitlab.test.tsx b/packages/zitadel-react/src/components/SignInWithGitlab.test.tsx index 14d66f114b4..7b8bc0ca1f5 100644 --- a/packages/zitadel-react/src/components/SignInWithGitlab.test.tsx +++ b/packages/zitadel-react/src/components/SignInWithGitlab.test.tsx @@ -7,9 +7,15 @@ describe("", () => { expect(container.firstChild).toBeDefined(); }); - it("displays the correct text", () => { + it("displays the default text", () => { render(); const signInText = screen.getByText(/Sign in with Gitlab/i); expect(signInText).toBeInTheDocument(); }); + + it("displays the given text", () => { + render(); + const signInText = screen.getByText(/Gitlab/i); + expect(signInText).toBeInTheDocument(); + }); }); diff --git a/packages/zitadel-react/src/components/SignInWithGoogle.test.tsx b/packages/zitadel-react/src/components/SignInWithGoogle.test.tsx index b2b41be7feb..016ca15bd7c 100644 --- a/packages/zitadel-react/src/components/SignInWithGoogle.test.tsx +++ b/packages/zitadel-react/src/components/SignInWithGoogle.test.tsx @@ -1,15 +1,21 @@ -import { render, screen } from '@testing-library/react'; -import { SignInWithGitlab } from './SignInWithGitlab'; +import { render, screen } from "@testing-library/react"; +import { SignInWithGoogle } from "./SignInWithGoogle"; -describe('', () => { - it('renders without crashing', () => { - const { container } = render(); - expect(container.firstChild).toBeDefined(); - }); +describe("", () => { + it("renders without crashing", () => { + const { container } = render(); + expect(container.firstChild).toBeDefined(); + }); - it('displays the correct text', () => { - render(); - const signInText = screen.getByText(/Sign in with Gitlab/i); - expect(signInText).toBeInTheDocument(); - }); -}); \ No newline at end of file + it("displays the default text", () => { + render(); + const signInText = screen.getByText(/Sign in with Google/i); + expect(signInText).toBeInTheDocument(); + }); + + it("displays the given text", () => { + render(); + const signInText = screen.getByText(/Google/i); + expect(signInText).toBeInTheDocument(); + }); +});