Skip to content

Commit

Permalink
test: update __STORYBOOK_PREVIEW__ mock for storyErrored event
Browse files Browse the repository at this point in the history
  • Loading branch information
nilshah98 committed Nov 1, 2023
1 parent 254b326 commit 6b0129b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/storybook.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ describe('percy storybook', () => {
it('errors when the storybook page errors', async () => {
server.reply('/iframe.html', () => [200, 'text/html', [
`<script>__STORYBOOK_PREVIEW__ = { async extract() {}, ${
'channel: { emit() {}, on: (a, c) => a === "storyErrored" && c(new Error("Story Error")) }'
'channel: { emit() {}, on: (a, c) => a === "storyErrored" && c() }'
} }</script>`,
`<script>__STORYBOOK_STORY_STORE__ = { raw: () => ${JSON.stringify([
{ id: '1', kind: 'foo', name: 'bar' }
Expand Down Expand Up @@ -177,7 +177,7 @@ describe('percy storybook', () => {
it('skips the story and logs the error but does not break build', async () => {
server.reply('/iframe.html', () => [200, 'text/html', [
`<script>__STORYBOOK_PREVIEW__ = { async extract() {}, ${
'channel: { emit() {}, on: (a, c) => a === "storyErrored" && c(new Error("Story Error")) }'
'channel: { emit() {}, on: (a, c) => a === "storyErrored" && c() }'
} }</script>`,
`<script>__STORYBOOK_STORY_STORE__ = { raw: () => ${JSON.stringify([
{ id: '1', kind: 'foo', name: 'bar' }
Expand Down

0 comments on commit 6b0129b

Please sign in to comment.