From f5a108db6e4fa622324c348da6337a6fc1a64109 Mon Sep 17 00:00:00 2001 From: Ye-Chan Kang Date: Sat, 2 Mar 2024 03:44:45 +0900 Subject: [PATCH] refactor: move the test closer to the component --- src/__tests__/ui.test.tsx | 216 ------------------ .../common/Checkbox/checkbox.test.tsx | 50 ++++ src/components/common/Dialog/DialogClose.tsx | 2 +- src/components/common/Dialog/DialogToggle.tsx | 2 +- src/components/common/Dialog/dialog.test.tsx | 86 +++++++ .../common/Dropdown/DropdownToggle.tsx | 2 +- .../common/Dropdown/dropdown.test.tsx | 50 ++++ src/components/common/Form/form.test.tsx | 52 +++++ src/components/common/Select/SelectToggle.tsx | 2 +- src/{__tests__ => tests}/lib.test.tsx | 0 tsconfig.json | 4 +- vite.config.ts | 2 +- 12 files changed, 245 insertions(+), 223 deletions(-) delete mode 100644 src/__tests__/ui.test.tsx create mode 100644 src/components/common/Checkbox/checkbox.test.tsx create mode 100644 src/components/common/Dialog/dialog.test.tsx create mode 100644 src/components/common/Dropdown/dropdown.test.tsx create mode 100644 src/components/common/Form/form.test.tsx rename src/{__tests__ => tests}/lib.test.tsx (100%) diff --git a/src/__tests__/ui.test.tsx b/src/__tests__/ui.test.tsx deleted file mode 100644 index 702f5b8..0000000 --- a/src/__tests__/ui.test.tsx +++ /dev/null @@ -1,216 +0,0 @@ -import '@testing-library/jest-dom'; -import React from 'react'; -import { Route } from 'react-router-dom'; -import { describe, expect, it, vi } from 'vitest'; - -import { - Button, - Checkbox, - Dialog, - DialogClose, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogTitle, - DialogToggle, - Dropdown, - DropdownContent, - DropdownDivider, - DropdownItem, - DropdownLabel, - DropdownShortcut, - DropdownToggle, - Form, - Input, - InputDesc, - InputGroup, - Label, - Textarea, -} from '../'; -import { MockRouter, fireEvent, render, screen, waitFor } from '../libs/test'; - -describe('UI test', () => { - it('Fill out the Input and Textarea and submit the Form', async () => { - const handleSubmitFn = vi.fn().mockImplementation(e => e.preventDefault()); - - render( - - - - - - - - -