Skip to content

Commit

Permalink
Removed test assertion to check if theme is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
colinmurphy committed Dec 24, 2024
1 parent b94fd14 commit 0d65fa3
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ import type { BlocksTheme } from '../../src/types/theme';
import { renderHook } from '@testing-library/react'; // Import from @testing-library/react

describe('useBlocksTheme', () => {
it('Throws an error if not used within WordPressBlocksProvider', () => {
// Assert that renderHook throws an error when used outside of WordPressBlocksProvider
expect(() => {
renderHook(() => useBlocksTheme());
}).toThrow('useBlocksTheme hook was called outside of context, make sure your app is wrapped with WordPressBlocksProvider');
});

it('returns the passed in theme from WordPressBlocksProvider', () => {
// Wrapping component to provide context
const wrapper = ({ children }: PropsWithChildren<{}>) => {
Expand Down Expand Up @@ -46,4 +39,4 @@ describe('useBlocksTheme', () => {
// Check the correct theme is returned
expect(theme?.colors?.palette).toStrictEqual({ primary: 'black' });
});
});
});

0 comments on commit 0d65fa3

Please sign in to comment.