dba53a01b3
* whoAmI has the realm access information so when a new realm is created the whoAmI request has to be done again * fixed "add realm" button * remove debug * refactor * also force token update * refresh realm list on realm change
36 lines
877 B
TypeScript
36 lines
877 B
TypeScript
import React from "react";
|
|
import { DataLoader } from "../DataLoader";
|
|
import { act } from "@testing-library/react";
|
|
import { render, unmountComponentAtNode } from "react-dom";
|
|
|
|
let container: HTMLDivElement;
|
|
beforeEach(() => {
|
|
container = document.createElement("div");
|
|
document.body.appendChild(container);
|
|
});
|
|
|
|
afterEach(() => {
|
|
unmountComponentAtNode(container);
|
|
container.remove();
|
|
});
|
|
|
|
describe("<DataLoader />", () => {
|
|
it("render", async () => {
|
|
const loader = () => Promise.resolve(["a", "b"]);
|
|
await act(async () => {
|
|
render(
|
|
<DataLoader loader={loader}>
|
|
{(result) => (
|
|
<div>
|
|
{result.map((d, i) => (
|
|
<i key={i}>{d}</i>
|
|
))}
|
|
</div>
|
|
)}
|
|
</DataLoader>,
|
|
container
|
|
);
|
|
});
|
|
expect(container.textContent).toBe("ab");
|
|
});
|
|
});
|