mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-16 13:42:06 +00:00
fix unit tests
This commit is contained in:
@@ -1,18 +1,22 @@
|
|||||||
import { afterEach, describe, expect, test } from "vitest";
|
import { afterEach, describe, expect, test } from "vitest";
|
||||||
|
|
||||||
import { cleanup, render, screen } from "@testing-library/react";
|
import { cleanup, render, screen } from "@testing-library/react";
|
||||||
import { NextIntlClientProvider, useMessages } from "next-intl";
|
import { NextIntlClientProvider } from "next-intl";
|
||||||
|
|
||||||
import { SignInWithGitlab } from "./sign-in-with-gitlab";
|
import { SignInWithGitlab } from "./sign-in-with-gitlab";
|
||||||
|
|
||||||
afterEach(cleanup);
|
afterEach(cleanup);
|
||||||
|
|
||||||
describe("<SignInWithGitlab />", async () => {
|
describe("<SignInWithGitlab />", async () => {
|
||||||
const messages = useMessages();
|
const messages = {
|
||||||
|
idp: {
|
||||||
|
signInWithGitlab: "Sign in with GitLab",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
test("renders without crashing", () => {
|
test("renders without crashing", () => {
|
||||||
const { container } = render(
|
const { container } = render(
|
||||||
<NextIntlClientProvider messages={messages}>
|
<NextIntlClientProvider locale="en" messages={messages}>
|
||||||
<SignInWithGitlab />
|
<SignInWithGitlab />
|
||||||
</NextIntlClientProvider>,
|
</NextIntlClientProvider>,
|
||||||
);
|
);
|
||||||
@@ -21,7 +25,7 @@ describe("<SignInWithGitlab />", async () => {
|
|||||||
|
|
||||||
test("displays the default text", () => {
|
test("displays the default text", () => {
|
||||||
render(
|
render(
|
||||||
<NextIntlClientProvider messages={messages}>
|
<NextIntlClientProvider locale="en" messages={messages}>
|
||||||
<SignInWithGitlab />
|
<SignInWithGitlab />
|
||||||
</NextIntlClientProvider>,
|
</NextIntlClientProvider>,
|
||||||
);
|
);
|
||||||
@@ -31,7 +35,7 @@ describe("<SignInWithGitlab />", async () => {
|
|||||||
|
|
||||||
test("displays the given text", () => {
|
test("displays the given text", () => {
|
||||||
render(
|
render(
|
||||||
<NextIntlClientProvider messages={messages}>
|
<NextIntlClientProvider locale="en" messages={messages}>
|
||||||
<SignInWithGitlab name={"Gitlab"} />
|
<SignInWithGitlab name={"Gitlab"} />
|
||||||
</NextIntlClientProvider>,
|
</NextIntlClientProvider>,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,17 +2,20 @@ import { afterEach, describe, expect, test } from "vitest";
|
|||||||
|
|
||||||
import { cleanup, render, screen } from "@testing-library/react";
|
import { cleanup, render, screen } from "@testing-library/react";
|
||||||
import { NextIntlClientProvider } from "next-intl";
|
import { NextIntlClientProvider } from "next-intl";
|
||||||
import { getMessages } from "next-intl/server";
|
|
||||||
import { SignInWithGoogle } from "./sign-in-with-google";
|
import { SignInWithGoogle } from "./sign-in-with-google";
|
||||||
|
|
||||||
afterEach(cleanup);
|
afterEach(cleanup);
|
||||||
|
|
||||||
describe("<SignInWithGoogle />", async () => {
|
describe("<SignInWithGoogle />", async () => {
|
||||||
const messages = await getMessages({ locale: "en" });
|
const messages = {
|
||||||
|
idp: {
|
||||||
|
signInWithGoogle: "Sign in with Google",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
test("renders without crashing", () => {
|
test("renders without crashing", () => {
|
||||||
const { container } = render(
|
const { container } = render(
|
||||||
<NextIntlClientProvider messages={messages}>
|
<NextIntlClientProvider locale="en" messages={messages}>
|
||||||
<SignInWithGoogle />
|
<SignInWithGoogle />
|
||||||
</NextIntlClientProvider>,
|
</NextIntlClientProvider>,
|
||||||
);
|
);
|
||||||
@@ -21,7 +24,7 @@ describe("<SignInWithGoogle />", async () => {
|
|||||||
|
|
||||||
test("displays the default text", () => {
|
test("displays the default text", () => {
|
||||||
render(
|
render(
|
||||||
<NextIntlClientProvider messages={messages}>
|
<NextIntlClientProvider locale="en" messages={messages}>
|
||||||
<SignInWithGoogle />
|
<SignInWithGoogle />
|
||||||
</NextIntlClientProvider>,
|
</NextIntlClientProvider>,
|
||||||
);
|
);
|
||||||
@@ -31,7 +34,7 @@ describe("<SignInWithGoogle />", async () => {
|
|||||||
|
|
||||||
test("displays the given text", () => {
|
test("displays the given text", () => {
|
||||||
render(
|
render(
|
||||||
<NextIntlClientProvider messages={messages}>
|
<NextIntlClientProvider locale="en" messages={messages}>
|
||||||
<SignInWithGoogle name={"Google"} />
|
<SignInWithGoogle name={"Google"} />
|
||||||
</NextIntlClientProvider>,
|
</NextIntlClientProvider>,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user