forked from dmm-com/pagoda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImportForm.test.tsx
35 lines (28 loc) · 933 Bytes
/
ImportForm.test.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* @jest-environment jsdom
*/
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
import React from "react";
import { TestWrapper } from "TestWrapper";
import { ImportForm } from "components/common/ImportForm";
describe("ImportForm", () => {
const file = new Blob(["key: value"], {
type: "application/yaml",
});
test("should import a file successfully", async () => {
const handleImport = () => Promise.resolve();
render(<ImportForm handleImport={handleImport} />, {
wrapper: TestWrapper,
});
// upload a file
await waitFor(() => {
fireEvent.change(screen.getByTestId("upload-import-file"), {
target: { files: [file] },
});
screen.getByRole("button", { name: "インポート" }).click();
});
expect(
screen.queryByText("ファイルのアップロードに失敗しました"),
).not.toBeInTheDocument();
});
});