Skip to content

Commit

Permalink
Feat #30 - Fix snapshot test bug (matchMedia)
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-dassana committed Aug 11, 2020
1 parent e588bc2 commit ca616d4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/storybook.test.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
import initStoryshots from '@storybook/addon-storyshots'

Object.defineProperty(window, 'matchMedia', {
writable: true,
value: jest.fn().mockImplementation(query => ({
matches: false,
media: query,
onchange: null,
addListener: jest.fn(), // deprecated
removeListener: jest.fn(), // deprecated
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
dispatchEvent: jest.fn()
}))
})

initStoryshots()

0 comments on commit ca616d4

Please sign in to comment.