Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alissacrane-cb committed Nov 21, 2024
1 parent 8da143e commit 8d9edea
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 4 deletions.
18 changes: 17 additions & 1 deletion src/components/LoginButton.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { beforeAll, describe, expect, it } from 'vitest';
import { http, WagmiProvider, createConfig } from 'wagmi';
import { base } from 'wagmi/chains';
import { mock } from 'wagmi/connectors';
Expand Down Expand Up @@ -35,6 +35,22 @@ const renderWithProviders = (component: JSX.Element) => {
};

describe('LoginButton', () => {
beforeAll(() => {
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: (query: string) => ({
matches: false,
media: query,
onchange: null,
addListener: () => {}, // Deprecated
removeListener: () => {}, // Deprecated
addEventListener: () => {},
removeEventListener: () => {},
dispatchEvent: () => false,
}),
});
});

it('should render', () => {
renderWithProviders(<LoginButton />);
const walletWrapper = screen.getByTestId('ockConnectWallet_Container');
Expand Down
17 changes: 16 additions & 1 deletion src/components/SignupButton.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { beforeAll, describe, expect, it } from 'vitest';
import { http, WagmiProvider, createConfig } from 'wagmi';
import { base } from 'wagmi/chains';
import { mock } from 'wagmi/connectors';
Expand Down Expand Up @@ -35,6 +35,21 @@ const renderWithProviders = (component: JSX.Element) => {
};

describe('SignupButton', () => {
beforeAll(() => {
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: (query: string) => ({
matches: false,
media: query,
onchange: null,
addListener: () => {}, // Deprecated
removeListener: () => {}, // Deprecated
addEventListener: () => {},
removeEventListener: () => {},
dispatchEvent: () => false,
}),
});
});
it('should render', () => {
renderWithProviders(<SignupButton />);
const wallet = screen.getByTestId('ockConnectWallet_Container');
Expand Down
17 changes: 16 additions & 1 deletion src/components/TransactionWrapper.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { beforeAll, describe, expect, it } from 'vitest';
import { http, WagmiProvider, createConfig } from 'wagmi';
import { base } from 'wagmi/chains';
import { mock } from 'wagmi/connectors';
Expand Down Expand Up @@ -34,6 +34,21 @@ const renderWithProviders = (component: JSX.Element) => {
};

describe('TransactionWrapper', () => {
beforeAll(() => {
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: (query: string) => ({
matches: false,
media: query,
onchange: null,
addListener: () => {}, // Deprecated
removeListener: () => {}, // Deprecated
addEventListener: () => {},
removeEventListener: () => {},
dispatchEvent: () => false,
}),
});
});
it('should renders', () => {
renderWithProviders(
<TransactionWrapper address="0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" />,
Expand Down
17 changes: 16 additions & 1 deletion src/components/WalletWrapper.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { beforeAll, describe, expect, it } from 'vitest';
import { http, WagmiProvider, createConfig } from 'wagmi';
import { base } from 'wagmi/chains';
import { mock } from 'wagmi/connectors';
Expand Down Expand Up @@ -34,6 +34,21 @@ const renderWithProviders = (Component: React.ComponentType) => {
};

describe('WalletWrapper', () => {
beforeAll(() => {
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: (query: string) => ({
matches: false,
media: query,
onchange: null,
addListener: () => {}, // Deprecated
removeListener: () => {}, // Deprecated
addEventListener: () => {},
removeEventListener: () => {},
dispatchEvent: () => false,
}),
});
});
it('should renders', () => {
renderWithProviders(WalletWrapper);
const wallet = screen.getByTestId('ockConnectWallet_Container');
Expand Down

0 comments on commit 8d9edea

Please sign in to comment.