Compare commits
2 Commits
931ade90a3
...
ba2274c76e
| Author | SHA1 | Date | |
|---|---|---|---|
| ba2274c76e | |||
| 3f6461d17e |
@@ -3,23 +3,30 @@ import { render, screen, act } from "@testing-library/react";
|
|||||||
import ConfigProvider from "../src/ConfigProvider";
|
import ConfigProvider from "../src/ConfigProvider";
|
||||||
|
|
||||||
global.fetch = jest.fn(() =>
|
global.fetch = jest.fn(() =>
|
||||||
Promise.resolve({
|
new Promise((resolve) =>
|
||||||
ok: true,
|
setTimeout(() => {
|
||||||
json: () =>
|
resolve({
|
||||||
Promise.resolve({
|
ok: true,
|
||||||
BACKEND_HOST: "http://localhost:5000",
|
json: () =>
|
||||||
FRONTEND_HOST: "http://localhost:3000",
|
Promise.resolve({
|
||||||
}),
|
BACKEND_HOST: "http://localhost:5000",
|
||||||
})
|
FRONTEND_HOST: "http://localhost:3000",
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}, 100)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
describe("ConfigProvider", () => {
|
describe("ConfigProvider", () => {
|
||||||
it("should display loading initially", () => {
|
it("should display loading initially", async () => {
|
||||||
render(
|
await act(async () => {
|
||||||
<ConfigProvider>
|
render(
|
||||||
<div>Loaded</div>
|
<ConfigProvider>
|
||||||
</ConfigProvider>
|
<div>Loaded</div>
|
||||||
);
|
</ConfigProvider>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
expect(screen.getByText(/Loading configuration/i)).toBeInTheDocument();
|
expect(screen.getByText(/Loading configuration/i)).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user