Skip to content

Commit

Permalink
fix: restore mock after test run
Browse files Browse the repository at this point in the history
  • Loading branch information
fmorency committed Sep 9, 2024
1 parent f91faf9 commit 72f6894
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
5 changes: 4 additions & 1 deletion components/factory/components/__tests__/MyDenoms.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { afterEach, describe, expect, test, jest, mock } from 'bun:test';
import { afterAll, afterEach, describe, expect, test, jest, mock } from 'bun:test';
import React from 'react';
import { screen, cleanup, fireEvent } from '@testing-library/react';
import MyDenoms from '@/components/factory/components/MyDenoms';
Expand Down Expand Up @@ -37,6 +37,9 @@ const allDenoms = [mockDenom, mockMfxDenom];

describe('MyDenoms', () => {
afterEach(cleanup);
afterAll(() => {
mock.restore();
});

test('renders loading skeleton when isLoading is true', () => {
renderWithProps({ isLoading: true });
Expand Down
5 changes: 4 additions & 1 deletion components/factory/components/__tests__/metaBox.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { afterEach, describe, expect, test, jest, mock } from 'bun:test';
import { afterAll, afterEach, describe, expect, test, jest, mock } from 'bun:test';
import React from 'react';
import { screen, cleanup, waitFor, within } from '@testing-library/react';
import MetaBox from '@/components/factory/components/metaBox';
Expand Down Expand Up @@ -41,6 +41,9 @@ const renderWithProps = (props = {}) => {

describe('MetaBox', () => {
afterEach(cleanup);
afterAll(() => {
mock.restore();
});

test("renders 'Select a token to view options' message when no denom is provided", () => {
renderWithProps();
Expand Down
5 changes: 4 additions & 1 deletion components/groups/components/__tests__/groupInfo.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { afterEach, describe, expect, test, jest, mock, beforeAll } from 'bun:test';
import { afterAll, afterEach, describe, expect, test, jest, mock, beforeAll } from 'bun:test';
import React from 'react';
import { screen, cleanup, fireEvent } from '@testing-library/react';
import { GroupInfo } from '@/components/groups/components/groupInfo';
Expand Down Expand Up @@ -34,6 +34,9 @@ describe('GroupInfo', () => {
m.mockReturnValue({ balance: { amount: '1000000' } });
});
afterEach(cleanup);
afterAll(() => {
mock.restore();
});

test('renders initial state correctly', () => {
renderWithProps();
Expand Down
5 changes: 4 additions & 1 deletion components/groups/components/__tests__/myGroups.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, expect, test, jest, mock, afterEach } from 'bun:test';
import { afterAll, describe, expect, test, jest, mock, afterEach } from 'bun:test';
import { screen, cleanup, waitFor, fireEvent } from '@testing-library/react';
import { YourGroups } from '@/components/groups/components/myGroups';
import { mockGroup, mockGroup2, mockProposals } from '@/tests/mock';
Expand Down Expand Up @@ -33,6 +33,9 @@ function renderWithProps(props = {}) {

describe('YourGroups Component', () => {
afterEach(cleanup);
afterAll(() => {
mock.restore();
});

test('renders empty group state correctly', () => {
renderWithProps({ groups: { groups: [] } });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, test, afterEach, expect, jest, mock } from 'bun:test';
import { afterAll, describe, test, afterEach, expect, jest, mock } from 'bun:test';
import React from 'react';
import { screen, fireEvent, cleanup } from '@testing-library/react';
import ConfirmationModal from '@/components/groups/forms/groups/ConfirmationForm';
Expand Down Expand Up @@ -30,6 +30,9 @@ const mockProps = {

describe('ConfirmationModal Component', () => {
afterEach(cleanup);
afterAll(() => {
mock.restore();
});

test('renders component with correct details', () => {
renderWithChainProvider(<ConfirmationModal {...mockProps} />);
Expand Down

0 comments on commit 72f6894

Please sign in to comment.