Skip to content

Commit

Permalink
Merge pull request #27426 from storybookjs/update-sub-path-imports-sn…
Browse files Browse the repository at this point in the history
…ippets

Docs: Use absolute imports in module mocking snippets
(cherry picked from commit fa80d22)
  • Loading branch information
kylegach authored and storybook-bot committed Jun 4, 2024
1 parent b3df59c commit 97374d1
Show file tree
Hide file tree
Showing 17 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion docs/snippets/angular/before-each-in-meta-mock-date.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { Meta, StoryObj } from '@storybook/angular';
import MockDate from 'mockdate';

// 👇 Must include the `.mock` portion of filename to have mocks typed correctly
import { getUserFromSession } from '../../api/session.mock';
import { getUserFromSession } from '#api/session.mock';
import { Page } from './Page';

const meta: Meta<Page> = {
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/angular/storybook-test-fn-mock-spy.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import type { Meta, StoryObj } from '@storybook/angular';
import { expect, userEvent, within } from '@storybook/test';

// 👇 Must include the `.mock` portion of filename to have mocks typed correctly
import { saveNote } from '../../app/actions.mock';
import { createNotes } from '../../mocks/notes';
import { saveNote } from '#app/actions.mock';
import { createNotes } from '#mocks/notes';
import NoteUI from './note-ui';

const meta: Meta<NoteUI> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import type { Meta, StoryObj } from '@storybook/angular';

// 👇 Must include the `.mock` portion of filename to have mocks typed correctly
import { getUserFromSession } from '../../api/session.mock';
import { getUserFromSession } from '#api/session.mock';
import { Page } from './Page';

const meta: Meta<Page> = {
Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/common/before-each-in-meta-mock-date.js.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Page.stories.js
import MockDate from 'mockdate';

import { getUserFromSession } from '../../api/session.mock';
import { getUserFromSession } from '#api/session.mock';
import { Page } from './Page';

export default {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { Meta, StoryObj } from '@storybook/your-renderer';
import MockDate from 'mockdate';

// 👇 Must include the `.mock` portion of filename to have mocks typed correctly
import { getUserFromSession } from '../../api/session.mock';
import { getUserFromSession } from '#api/session.mock';
import { Page } from './Page';

const meta = {
Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/common/before-each-in-meta-mock-date.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { Meta, StoryObj } from '@storybook/your-renderer';
import MockDate from 'mockdate';

// 👇 Must include the `.mock` portion of filename to have mocks typed correctly
import { getUserFromSession } from '../../api/session.mock';
import { getUserFromSession } from '#api/session.mock';
import { Page } from './Page';

const meta: Meta<typeof Page> = {
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/common/storybook-test-fn-mock-spy.js.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// NoteUI.stories.js
import { expect, userEvent, within } from '@storybook/test';

import { saveNote } from '../../app/actions.mock';
import { createNotes } from '../../mocks/notes';
import { saveNote } from '#app/actions.mock';
import { createNotes } from '#mocks/notes';
import NoteUI from './note-ui';

export default {
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/common/storybook-test-fn-mock-spy.ts-4-9.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import type { Meta, StoryObj } from '@storybook/your-renderer';
import { expect, userEvent, within } from '@storybook/test';

// 👇 Must include the `.mock` portion of filename to have mocks typed correctly
import { saveNote } from '../../app/actions.mock';
import { createNotes } from '../../mocks/notes';
import { saveNote } from '#app/actions.mock';
import { createNotes } from '#mocks/notes';
import NoteUI from './note-ui';

const meta = {
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/common/storybook-test-fn-mock-spy.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import type { Meta, StoryObj } from '@storybook/your-renderer';
import { expect, userEvent, within } from '@storybook/test';

// 👇 Must include the `.mock` portion of filename to have mocks typed correctly
import { saveNote } from '../../app/actions.mock';
import { createNotes } from '../../mocks/notes';
import { saveNote } from '#app/actions.mock';
import { createNotes } from '#mocks/notes';
import NoteUI from './note-ui';

const meta: Meta<typeof NoteUI> = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
```js
// Page.stories.js
import { getUserFromSession } from '../../api/session.mock';
import { getUserFromSession } from '#api/session.mock';
import { Page } from './Page';

export default {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import type { Meta, StoryObj } from '@storybook/your-renderer';

// 👇 Must include the `.mock` portion of filename to have mocks typed correctly
import { getUserFromSession } from '../../api/session.mock';
import { getUserFromSession } from '#api/session.mock';
import { Page } from './Page';

const meta = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import type { Meta, StoryObj } from '@storybook/your-renderer';

// 👇 Must include the `.mock` portion of filename to have mocks typed correctly
import { getUserFromSession } from '../../api/session.mock';
import { getUserFromSession } from '#api/session.mock';
import { Page } from './Page';

const meta: Meta<typeof Page> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { Meta, StoryObj } from '@storybook/web-components';
import MockDate from 'mockdate';

// 👇 Must include the `.mock` portion of filename to have mocks typed correctly
import { getUserFromSession } from '../../api/session.mock';
import { getUserFromSession } from '#api/session.mock';

const meta: Meta = {
component: 'my-page',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// NoteUI.stories.js
import { expect, userEvent, within } from '@storybook/test';

import { saveNote } from '../../app/actions.mock';
import { createNotes } from '../../mocks/notes';
import { saveNote } from '#app/actions.mock';
import { createNotes } from '#mocks/notes';

export default {
title: 'Mocked/NoteUI',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import type { Meta, StoryObj } from '@storybook/react';
import { expect, userEvent, within } from '@storybook/test';

// 👇 Must include the `.mock` portion of filename to have mocks typed correctly
import { saveNote } from '../../app/actions.mock';
import { createNotes } from '../../mocks/notes';
import { saveNote } from '#app/actions.mock';
import { createNotes } from '#mocks/notes';

const meta: Meta = {
title: 'Mocked/NoteUI',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
```js
// Page.stories.js
import { getUserFromSession } from '../../api/session.mock';
import { getUserFromSession } from '#api/session.mock';

export default {
component: 'my-page',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import type { Meta, StoryObj } from '@storybook/web-components';

// 👇 Must include the `.mock` portion of filename to have mocks typed correctly
import { getUserFromSession } from '../../api/session.mock';
import { getUserFromSession } from '#api/session.mock';

const meta: Meta = {
component: 'my-page',
Expand Down

0 comments on commit 97374d1

Please sign in to comment.