Skip to content

Commit dbd0bc4

Browse files
fix: Correct component test imports and props
Corrected the import statements in all component test files to use the actual exported component names (e.g., `NesButton`, `NesCheckbox`). Many components were being imported with generic names like `Button` while the actual exports were prefixed with `Nes`. Additionally, updated several smoke tests to include necessary props required for the components to render without errors, even for basic rendering checks. The `Dialog` component test was specifically corrected to reflect its actual implementation, which exports a `Dialog` component taking no props, after a previous erroneous correction attempt. These changes should resolve the "Element type is invalid" errors reported when running the tests.
1 parent 59d7768 commit dbd0bc4

18 files changed

Lines changed: 31 additions & 31 deletions

File tree

src/Avatar/Avatar.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { render } from '@testing-library/react';
22
import '@testing-library/jest-dom';
3-
import { Avatar } from './index';
3+
import { NesAvatar as Avatar } from './index';
44

55
describe('Avatar', () => {
66
it('renders without crashing', () => {
7-
render(<Avatar />);
7+
render(<Avatar imgSrc="test.png" iconSize="small" />);
88
});
99
});

src/Badge/Badge.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { render } from '@testing-library/react';
22
import '@testing-library/jest-dom';
3-
import { Badge } from './index';
3+
import { NesBadge as Badge } from './index';
44

55
describe('Badge', () => {
66
it('renders without crashing', () => {
7-
render(<Badge />);
7+
render(<Badge badgeType={['primary']} contents={['Test']} />);
88
});
99
});

src/Balloon/Balloon.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { render } from '@testing-library/react';
22
import '@testing-library/jest-dom';
3-
import { Balloon } from './index';
3+
import { NesBalloon as Balloon } from './index';
44

55
describe('Balloon', () => {
66
it('renders without crashing', () => {
7-
render(<Balloon>Test</Balloon>);
7+
render(<Balloon isLeft={true} content="Test" />);
88
});
99
});

src/Button/Button.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { render, screen } from '@testing-library/react';
22
import '@testing-library/jest-dom';
3-
import { Button } from './Button';
3+
import { NesButton as Button } from './index';
44

55
describe('Button', () => {
66
it('renders the button with the correct text', () => {

src/Checkbox/Checkbox.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { render } from '@testing-library/react';
22
import '@testing-library/jest-dom';
3-
import { Checkbox } from './index';
3+
import { NesCheckbox as Checkbox } from './index';
44

55
describe('Checkbox', () => {
66
it('renders without crashing', () => {
7-
render(<Checkbox />);
7+
render(<Checkbox items={['Test']} />);
88
});
99
});

src/Container/Container.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { render } from '@testing-library/react';
22
import '@testing-library/jest-dom';
3-
import { Container } from './index';
3+
import { NesContainer as Container } from './index';
44

55
describe('Container', () => {
66
it('renders without crashing', () => {
7-
render(<Container />);
7+
render(<Container content="Test" />);
88
});
99
});

src/Cursor/Cursor.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { render } from '@testing-library/react';
22
import '@testing-library/jest-dom';
3-
import { Cursor } from './index';
3+
import { NesCursor as Cursor } from './index';
44

55
describe('Cursor', () => {
66
it('renders without crashing', () => {
7-
render(<Cursor />);
7+
render(<Cursor isLeft={true} content="Test" />);
88
});
99
});

src/Dialog/Dialog.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { render } from '@testing-library/react';
22
import '@testing-library/jest-dom';
3-
import { Dialog } from './index';
3+
import { Dialog } from './index'; // Ensure this imports the actual Dialog component
44

55
describe('Dialog', () => {
66
it('renders without crashing', () => {
7-
render(<Dialog id="test-dialog" />);
7+
render(<Dialog />); // No props, as the component takes no props
88
});
99
});

src/Dropdown/Dropdown.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { render } from '@testing-library/react';
22
import '@testing-library/jest-dom';
3-
import { Dropdown } from './index';
3+
import { NesDropdown as Dropdown } from './index';
44

55
describe('Dropdown', () => {
66
it('renders without crashing', () => {

src/Icon/Icon.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { render } from '@testing-library/react';
22
import '@testing-library/jest-dom';
3-
import { Icon } from './Icon';
3+
import { NesIcon as Icon } from './index';
44

55
describe('Icon', () => {
66
it('renders without crashing', () => {

0 commit comments

Comments
 (0)