Skip to content

Commit

Permalink
OPHJOD-316: Remove unnecessary cleanup calls
Browse files Browse the repository at this point in the history
  • Loading branch information
sauanto committed Apr 10, 2024
1 parent 5456624 commit 5d2a7b3
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 60 deletions.
8 changes: 2 additions & 6 deletions lib/components/DropdownMenu/DropdownMenu.test.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { afterEach, describe, expect, it, vi } from 'vitest';
import { render, screen, cleanup } from '@testing-library/react';
import { describe, expect, it, vi } from 'vitest';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';

import { DropdownMenu } from './DropdownMenu';

afterEach(() => {
cleanup();
});

const options = [
{ value: 'fi', label: 'Suomi' },
{ value: 'sv', label: 'Svenska' },
Expand Down
8 changes: 2 additions & 6 deletions lib/components/Expander/Expander.test.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import { render, screen, cleanup } from '@testing-library/react';
import { afterEach, describe, expect, test } from 'vitest';
import { render, screen } from '@testing-library/react';
import { describe, expect, test } from 'vitest';
import '@testing-library/jest-dom/vitest';
import userEvent from '@testing-library/user-event';

import { Expander } from './Expander';

afterEach(() => {
cleanup();
});

describe('Snapshot testing', () => {
test('Base button', () => {
const { container } = render(
Expand Down
8 changes: 2 additions & 6 deletions lib/components/HeroCard/HeroCard.test.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { afterEach, describe, it, expect } from 'vitest';
import { render, screen, cleanup } from '@testing-library/react';
import { describe, it, expect } from 'vitest';
import { render, screen } from '@testing-library/react';
import '@testing-library/jest-dom';

import { HeroCard } from './HeroCard';

afterEach(() => {
cleanup();
});

describe('HeroCard', () => {
const title = 'Test Title';
const content = 'Test Content';
Expand Down
8 changes: 2 additions & 6 deletions lib/components/NavigationBar/NavigationBar.test.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { afterEach, describe, it, expect } from 'vitest';
import { render, screen, cleanup } from '@testing-library/react';
import { describe, it, expect } from 'vitest';
import { render, screen } from '@testing-library/react';
import '@testing-library/jest-dom';

import { NavigationBar, NavigationBarLinkProps } from './NavigationBar';

afterEach(() => {
cleanup();
});

describe('NavigationBar', () => {
const items = [
{
Expand Down
8 changes: 2 additions & 6 deletions lib/components/RadioButton/RadioButton.test.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import { render, screen, cleanup } from '@testing-library/react';
import { afterEach, describe, expect, it, test, vi } from 'vitest';
import { render, screen } from '@testing-library/react';
import { describe, expect, it, test, vi } from 'vitest';
import { RadioButtonGroup } from './RadioButtonGroup';
import { RadioButton } from './RadioButton';
import '@testing-library/jest-dom/vitest';
import React from 'react';

afterEach(() => {
cleanup();
});

const Wrapper = ({ children }: { children: React.ReactNode }) => {
return (
<RadioButtonGroup label="Label" value="a" onChange={vi.fn()}>
Expand Down
8 changes: 2 additions & 6 deletions lib/components/RadioButton/RadioButtonGroup.test.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import { render, screen, cleanup } from '@testing-library/react';
import { afterEach, describe, expect, it, test, vi } from 'vitest';
import { render, screen } from '@testing-library/react';
import { describe, expect, it, test, vi } from 'vitest';
import userEvent from '@testing-library/user-event';
import { RadioButtonGroup } from './RadioButtonGroup';
import { RadioButton } from './RadioButton';
import '@testing-library/jest-dom/vitest';

afterEach(() => {
cleanup();
});

describe('Snapshot testing', () => {
test('Default', () => {
const { container } = render(
Expand Down
8 changes: 2 additions & 6 deletions lib/components/ResultsCard/ResultsCard.test.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { afterEach, describe, expect, it } from 'vitest';
import { render, screen, cleanup } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { render, screen } from '@testing-library/react';
import '@testing-library/jest-dom/vitest';

import { ResultsCard } from './ResultsCard';

afterEach(() => {
cleanup();
});

describe('ResultsCard', () => {
const text = 'Lorem ipsum';
const label = 'Dolor sit amet';
Expand Down
8 changes: 2 additions & 6 deletions lib/components/RoundButton/RoundButton.test.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { afterEach, describe, expect, it, test, vi } from 'vitest';
import { screen, render, cleanup } from '@testing-library/react';
import { describe, expect, it, test, vi } from 'vitest';
import { screen, render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';

import { RoundButton } from './RoundButton';

afterEach(() => {
cleanup();
});

describe('Snapshot testing', () => {
test('Default', () => {
const { container } = render(<RoundButton label="Default" onClick={vi.fn()} />);
Expand Down
8 changes: 2 additions & 6 deletions lib/components/RoundLinkButton/RoundLinkButton.test.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { afterEach, describe, expect, it, test } from 'vitest';
import { screen, render, cleanup } from '@testing-library/react';
import { describe, expect, it, test } from 'vitest';
import { screen, render } from '@testing-library/react';

import { RoundLinkButton } from './RoundLinkButton';

afterEach(() => {
cleanup();
});

const DummyLink = () => {
return <a href="/#">label</a>;
};
Expand Down
8 changes: 2 additions & 6 deletions lib/components/Toast/Toast.test.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { afterEach, describe, expect, it } from 'vitest';
import { render, screen, cleanup } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { render, screen } from '@testing-library/react';
import '@testing-library/jest-dom/vitest';

import { Toast } from './Toast';

afterEach(() => {
cleanup();
});

describe('Toast', () => {
it('renders the toast component with text', () => {
const { container } = render(<Toast text="This is a toast message" />);
Expand Down

0 comments on commit 5d2a7b3

Please sign in to comment.