Added react-oidc (use demo/demo)

Added an example of an authentication protected page (tenders)
Added an example with the built in proxy (to combat CORS) (tendersguru)
This commit is contained in:
2022-07-26 11:15:36 +02:00
parent 8496f5cfbe
commit b9d3025163
24 changed files with 400 additions and 33 deletions

View File

@@ -1,18 +1,25 @@
import { render, screen } from "@testing-library/react";
import { render, screen, waitFor } from "@testing-library/react";
import { WithTestTranslations } from "../../app/tests/mocks/i18n/WithTestTranslations";
import { OidcProvider } from "../sso/OidcProvider";
import { WithRouter } from "../wrappers/WithRouter";
import { Navbar } from "./Navbar";
describe("Navbar container", () => {
it.only("renders a navigation section identified by the nav test-id", () => {
it.only("renders a navigation section identified by the nav test-id", async () => {
render(
<WithTestTranslations>
<WithRouter>
<Navbar />
</WithRouter>
{/* for simple tests where we don't need auth we don't actually have to mock responses */}
<OidcProvider>
<WithRouter>
<Navbar />
</WithRouter>
</OidcProvider>
</WithTestTranslations>,
);
expect(screen.getAllByTestId("nav")?.length).toBeGreaterThan(0);
// because of the extra loaders we wait for a result just to be sure
// see: https://testing-library.com/docs/guide-disappearance/
await waitFor(() => {
expect(screen.getAllByTestId("nav")?.length).toBeGreaterThan(0);
});
});
});