@storybook/tanstack-react 11.0.0-beta.0 → 11.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,328 +2,19 @@ import React from "react";
2
2
  import { Navigate as Navigate$1, useBlocker as useBlocker$1, useCanGoBack as useCanGoBack$1, useLinkProps as useLinkProps$1, useLoaderData as useLoaderData$1, useLoaderDeps as useLoaderDeps$1, useLocation as useLocation$1, useNavigate as useNavigate$1, useParams as useParams$1, useRouteContext as useRouteContext$1, useRouter as useRouter$1, useRouterState as useRouterState$1, useSearch as useSearch$1 } from "@tanstack/react-router";
3
3
  export * from "@tanstack/react-router";
4
4
 
5
- //#region node_modules/@vitest/spy/dist/index.d.ts
6
- interface MockResultReturn<T> {
7
- type: "return";
8
- /**
9
- * The value that was returned from the function. If function returned a Promise, then this will be a resolved value.
10
- */
11
- value: T;
12
- }
13
- interface MockResultIncomplete {
14
- type: "incomplete";
15
- value: undefined;
16
- }
17
- interface MockResultThrow {
18
- type: "throw";
19
- /**
20
- * An error that was thrown during function execution.
21
- */
22
- value: any;
23
- }
24
- interface MockSettledResultFulfilled<T> {
25
- type: "fulfilled";
26
- value: T;
27
- }
28
- interface MockSettledResultRejected {
29
- type: "rejected";
30
- value: any;
31
- }
32
- type MockResult<T> = MockResultReturn<T> | MockResultThrow | MockResultIncomplete;
33
- type MockSettledResult<T> = MockSettledResultFulfilled<T> | MockSettledResultRejected;
34
- interface MockContext<T extends Procedure> {
35
- /**
36
- * This is an array containing all arguments for each call. One item of the array is the arguments of that call.
37
- *
38
- * @see https://vitest.dev/api/mock#mock-calls
39
- * @example
40
- * const fn = vi.fn()
41
- *
42
- * fn('arg1', 'arg2')
43
- * fn('arg3')
44
- *
45
- * fn.mock.calls === [
46
- * ['arg1', 'arg2'], // first call
47
- * ['arg3'], // second call
48
- * ]
49
- */
50
- calls: Parameters<T>[];
51
- /**
52
- * This is an array containing all instances that were instantiated when mock was called with a `new` keyword. Note that this is an actual context (`this`) of the function, not a return value.
53
- * @see https://vitest.dev/api/mock#mock-instances
54
- */
55
- instances: ReturnType<T>[];
56
- /**
57
- * An array of `this` values that were used during each call to the mock function.
58
- * @see https://vitest.dev/api/mock#mock-contexts
59
- */
60
- contexts: ThisParameterType<T>[];
61
- /**
62
- * The order of mock's execution. This returns an array of numbers which are shared between all defined mocks.
63
- *
64
- * @see https://vitest.dev/api/mock#mock-invocationcallorder
65
- * @example
66
- * const fn1 = vi.fn()
67
- * const fn2 = vi.fn()
68
- *
69
- * fn1()
70
- * fn2()
71
- * fn1()
72
- *
73
- * fn1.mock.invocationCallOrder === [1, 3]
74
- * fn2.mock.invocationCallOrder === [2]
75
- */
76
- invocationCallOrder: number[];
77
- /**
78
- * This is an array containing all values that were `returned` from the function.
79
- *
80
- * The `value` property contains the returned value or thrown error. If the function returned a `Promise`, then `result` will always be `'return'` even if the promise was rejected.
81
- *
82
- * @see https://vitest.dev/api/mock#mock-results
83
- * @example
84
- * const fn = vi.fn()
85
- * .mockReturnValueOnce('result')
86
- * .mockImplementationOnce(() => { throw new Error('thrown error') })
87
- *
88
- * const result = fn()
89
- *
90
- * try {
91
- * fn()
92
- * }
93
- * catch {}
94
- *
95
- * fn.mock.results === [
96
- * {
97
- * type: 'return',
98
- * value: 'result',
99
- * },
100
- * {
101
- * type: 'throw',
102
- * value: Error,
103
- * },
104
- * ]
105
- */
106
- results: MockResult<ReturnType<T>>[];
107
- /**
108
- * An array containing all values that were `resolved` or `rejected` from the function.
109
- *
110
- * This array will be empty if the function was never resolved or rejected.
111
- *
112
- * @see https://vitest.dev/api/mock#mock-settledresults
113
- * @example
114
- * const fn = vi.fn().mockResolvedValueOnce('result')
115
- *
116
- * const result = fn()
117
- *
118
- * fn.mock.settledResults === []
119
- * fn.mock.results === [
120
- * {
121
- * type: 'return',
122
- * value: Promise<'result'>,
123
- * },
124
- * ]
125
- *
126
- * await result
127
- *
128
- * fn.mock.settledResults === [
129
- * {
130
- * type: 'fulfilled',
131
- * value: 'result',
132
- * },
133
- * ]
134
- */
135
- settledResults: MockSettledResult<Awaited<ReturnType<T>>>[];
136
- /**
137
- * This contains the arguments of the last call. If spy wasn't called, will return `undefined`.
138
- * @see https://vitest.dev/api/mock#mock-lastcall
139
- */
140
- lastCall: Parameters<T> | undefined;
141
- }
142
- type Procedure = (...args: any[]) => any; // pick a single function type from function overloads, unions, etc...
143
- type NormalizedProcedure<T extends Procedure> = (...args: Parameters<T>) => ReturnType<T>;
144
- /*
145
- cf. https://typescript-eslint.io/rules/method-signature-style/
146
-
147
- Typescript assignability is different between
148
- { foo: (f: T) => U } (this is "method-signature-style")
149
- and
150
- { foo(f: T): U }
151
-
152
- Jest uses the latter for `MockInstance.mockImplementation` etc... and it allows assignment such as:
153
- const boolFn: Jest.Mock<() => boolean> = jest.fn<() => true>(() => true)
154
- */
155
- /* eslint-disable ts/method-signature-style */
156
- interface MockInstance<T extends Procedure = Procedure> extends Disposable {
157
- /**
158
- * Use it to return the name assigned to the mock with the `.mockName(name)` method. By default, it will return `vi.fn()`.
159
- * @see https://vitest.dev/api/mock#getmockname
160
- */
161
- getMockName(): string;
162
- /**
163
- * Sets the internal mock name. This is useful for identifying the mock when an assertion fails.
164
- * @see https://vitest.dev/api/mock#mockname
165
- */
166
- mockName(name: string): this;
167
- /**
168
- * Current context of the mock. It stores information about all invocation calls, instances, and results.
169
- */
170
- mock: MockContext<T>;
171
- /**
172
- * Clears all information about every call. After calling it, all properties on `.mock` will return to their initial state. This method does not reset implementations. It is useful for cleaning up mocks between different assertions.
173
- *
174
- * To automatically call this method before each test, enable the [`clearMocks`](https://vitest.dev/config/#clearmocks) setting in the configuration.
175
- * @see https://vitest.dev/api/mock#mockclear
176
- */
177
- mockClear(): this;
178
- /**
179
- * Does what `mockClear` does and resets inner implementation to the original function. This also resets all "once" implementations.
180
- *
181
- * Note that resetting a mock from `vi.fn()` will set implementation to an empty function that returns `undefined`.
182
- * Resetting a mock from `vi.fn(impl)` will set implementation to `impl`. It is useful for completely resetting a mock to its default state.
183
- *
184
- * To automatically call this method before each test, enable the [`mockReset`](https://vitest.dev/config/#mockreset) setting in the configuration.
185
- * @see https://vitest.dev/api/mock#mockreset
186
- */
187
- mockReset(): this;
188
- /**
189
- * Does what `mockReset` does and restores original descriptors of spied-on objects.
190
- *
191
- * Note that restoring mock from `vi.fn()` will set implementation to an empty function that returns `undefined`. Restoring a `vi.fn(impl)` will restore implementation to `impl`.
192
- * @see https://vitest.dev/api/mock#mockrestore
193
- */
194
- mockRestore(): void;
195
- /**
196
- * Returns current permanent mock implementation if there is one.
197
- *
198
- * If mock was created with `vi.fn`, it will consider passed down method as a mock implementation.
199
- *
200
- * If mock was created with `vi.spyOn`, it will return `undefined` unless a custom implementation was provided.
201
- */
202
- getMockImplementation(): NormalizedProcedure<T> | undefined;
203
- /**
204
- * Accepts a function to be used as the mock implementation. TypeScript expects the arguments and return type to match those of the original function.
205
- * @see https://vitest.dev/api/mock#mockimplementation
206
- * @example
207
- * const increment = vi.fn().mockImplementation(count => count + 1);
208
- * expect(increment(3)).toBe(4);
209
- */
210
- mockImplementation(fn: NormalizedProcedure<T>): this;
211
- /**
212
- * Accepts a function to be used as the mock implementation. TypeScript expects the arguments and return type to match those of the original function. This method can be chained to produce different results for multiple function calls.
213
- *
214
- * When the mocked function runs out of implementations, it will invoke the default implementation set with `vi.fn(() => defaultValue)` or `.mockImplementation(() => defaultValue)` if they were called.
215
- * @see https://vitest.dev/api/mock#mockimplementationonce
216
- * @example
217
- * const fn = vi.fn(count => count).mockImplementationOnce(count => count + 1);
218
- * expect(fn(3)).toBe(4);
219
- * expect(fn(3)).toBe(3);
220
- */
221
- mockImplementationOnce(fn: NormalizedProcedure<T>): this;
222
- /**
223
- * Overrides the original mock implementation temporarily while the callback is being executed.
224
- *
225
- * Note that this method takes precedence over the [`mockImplementationOnce`](https://vitest.dev/api/mock#mockimplementationonce).
226
- * @see https://vitest.dev/api/mock#withimplementation
227
- * @example
228
- * const myMockFn = vi.fn(() => 'original')
229
- *
230
- * myMockFn.withImplementation(() => 'temp', () => {
231
- * myMockFn() // 'temp'
232
- * })
233
- *
234
- * myMockFn() // 'original'
235
- */
236
- withImplementation<T2>(fn: NormalizedProcedure<T>, cb: () => T2): T2 extends Promise<unknown> ? Promise<this> : this;
237
- /**
238
- * Use this if you need to return the `this` context from the method without invoking the actual implementation.
239
- * @see https://vitest.dev/api/mock#mockreturnthis
240
- */
241
- mockReturnThis(): this;
242
- /**
243
- * Accepts a value that will be returned whenever the mock function is called. TypeScript will only accept values that match the return type of the original function.
244
- * @see https://vitest.dev/api/mock#mockreturnvalue
245
- * @example
246
- * const mock = vi.fn()
247
- * mock.mockReturnValue(42)
248
- * mock() // 42
249
- * mock.mockReturnValue(43)
250
- * mock() // 43
251
- */
252
- mockReturnValue(value: ReturnType<T>): this;
253
- /**
254
- * Accepts a value that will be returned whenever the mock function is called. TypeScript will only accept values that match the return type of the original function.
255
- *
256
- * When the mocked function runs out of implementations, it will invoke the default implementation set with `vi.fn(() => defaultValue)` or `.mockImplementation(() => defaultValue)` if they were called.
257
- * @example
258
- * const myMockFn = vi
259
- * .fn()
260
- * .mockReturnValue('default')
261
- * .mockReturnValueOnce('first call')
262
- * .mockReturnValueOnce('second call')
263
- *
264
- * // 'first call', 'second call', 'default'
265
- * console.log(myMockFn(), myMockFn(), myMockFn())
266
- */
267
- mockReturnValueOnce(value: ReturnType<T>): this;
268
- /**
269
- * Accepts a value that will be resolved when the async function is called. TypeScript will only accept values that match the return type of the original function.
270
- * @example
271
- * const asyncMock = vi.fn().mockResolvedValue(42)
272
- * asyncMock() // Promise<42>
273
- */
274
- mockResolvedValue(value: Awaited<ReturnType<T>>): this;
275
- /**
276
- * Accepts a value that will be resolved during the next function call. TypeScript will only accept values that match the return type of the original function. If chained, each consecutive call will resolve the specified value.
277
- * @example
278
- * const myMockFn = vi
279
- * .fn()
280
- * .mockResolvedValue('default')
281
- * .mockResolvedValueOnce('first call')
282
- * .mockResolvedValueOnce('second call')
283
- *
284
- * // Promise<'first call'>, Promise<'second call'>, Promise<'default'>
285
- * console.log(myMockFn(), myMockFn(), myMockFn())
286
- */
287
- mockResolvedValueOnce(value: Awaited<ReturnType<T>>): this;
288
- /**
289
- * Accepts an error that will be rejected when async function is called.
290
- * @example
291
- * const asyncMock = vi.fn().mockRejectedValue(new Error('Async error'))
292
- * await asyncMock() // throws Error<'Async error'>
293
- */
294
- mockRejectedValue(error: unknown): this;
295
- /**
296
- * Accepts a value that will be rejected during the next function call. If chained, each consecutive call will reject the specified value.
297
- * @example
298
- * const asyncMock = vi
299
- * .fn()
300
- * .mockResolvedValueOnce('first call')
301
- * .mockRejectedValueOnce(new Error('Async error'))
302
- *
303
- * await asyncMock() // first call
304
- * await asyncMock() // throws Error<'Async error'>
305
- */
306
- mockRejectedValueOnce(error: unknown): this;
307
- }
308
- /* eslint-enable ts/method-signature-style */
309
- interface Mock<T extends Procedure = Procedure> extends MockInstance<T> {
310
- new (...args: Parameters<T>): ReturnType<T>;
311
- (...args: Parameters<T>): ReturnType<T>;
312
- }
313
- //#endregion
314
5
  //#region code/frameworks/tanstack-react/.dts-emit/code/frameworks/tanstack-react/src/export-mocks/react-router.d.ts
315
- declare const useNavigate: Mock<typeof useNavigate$1>;
316
- declare const useRouter: Mock<typeof useRouter$1>;
317
- declare const useBlocker: Mock<typeof useBlocker$1>;
318
- declare const useSearch: Mock<typeof useSearch$1>;
319
- declare const useParams: Mock<typeof useParams$1>;
320
- declare const useLocation: Mock<typeof useLocation$1>;
321
- declare const useRouterState: Mock<typeof useRouterState$1>;
322
- declare const useLoaderData: Mock<typeof useLoaderData$1>;
323
- declare const useLoaderDeps: Mock<typeof useLoaderDeps$1>;
324
- declare const useRouteContext: Mock<typeof useRouteContext$1>;
325
- declare const useCanGoBack: Mock<typeof useCanGoBack$1>;
326
- declare const useLinkProps: Mock<typeof useLinkProps$1>;
6
+ declare const useNavigate: import("storybook/test").Mock<typeof useNavigate$1>;
7
+ declare const useRouter: import("storybook/test").Mock<typeof useRouter$1>;
8
+ declare const useBlocker: import("storybook/test").Mock<typeof useBlocker$1>;
9
+ declare const useSearch: import("storybook/test").Mock<typeof useSearch$1>;
10
+ declare const useParams: import("storybook/test").Mock<typeof useParams$1>;
11
+ declare const useLocation: import("storybook/test").Mock<typeof useLocation$1>;
12
+ declare const useRouterState: import("storybook/test").Mock<typeof useRouterState$1>;
13
+ declare const useLoaderData: import("storybook/test").Mock<typeof useLoaderData$1>;
14
+ declare const useLoaderDeps: import("storybook/test").Mock<typeof useLoaderDeps$1>;
15
+ declare const useRouteContext: import("storybook/test").Mock<typeof useRouteContext$1>;
16
+ declare const useCanGoBack: import("storybook/test").Mock<typeof useCanGoBack$1>;
17
+ declare const useLinkProps: import("storybook/test").Mock<typeof useLinkProps$1>;
327
18
  declare const Navigate: typeof Navigate$1;
328
19
  type LinkRenderState = {
329
20
  isActive: boolean;
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_kxz6xu3xsog from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_kxz6xu3xsog from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_kxz6xu3xsog from "node:module";
1
+ import CJS_COMPAT_NODE_URL_u0ntmjk5f5 from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_u0ntmjk5f5 from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_u0ntmjk5f5 from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_kxz6xu3xsog.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_kxz6xu3xsog.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_kxz6xu3xsog.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_u0ntmjk5f5.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_u0ntmjk5f5.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_u0ntmjk5f5.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
package/dist/preset.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_kxz6xu3xsog from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_kxz6xu3xsog from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_kxz6xu3xsog from "node:module";
1
+ import CJS_COMPAT_NODE_URL_u0ntmjk5f5 from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_u0ntmjk5f5 from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_u0ntmjk5f5 from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_kxz6xu3xsog.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_kxz6xu3xsog.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_kxz6xu3xsog.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_u0ntmjk5f5.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_u0ntmjk5f5.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_u0ntmjk5f5.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/tanstack-react",
3
- "version": "11.0.0-beta.0",
3
+ "version": "11.0.0-beta.2",
4
4
  "description": "Storybook for TanStack (React, Vite): Router and Start ready Storybook framework",
5
5
  "keywords": [
6
6
  "storybook",
@@ -75,9 +75,9 @@
75
75
  "!src/**/*"
76
76
  ],
77
77
  "dependencies": {
78
- "@storybook/builder-vite": "11.0.0-beta.0",
79
- "@storybook/react": "11.0.0-beta.0",
80
- "@storybook/react-vite": "11.0.0-beta.0"
78
+ "@storybook/builder-vite": "11.0.0-beta.2",
79
+ "@storybook/react": "11.0.0-beta.2",
80
+ "@storybook/react-vite": "11.0.0-beta.2"
81
81
  },
82
82
  "devDependencies": {
83
83
  "@tanstack/react-router": "^1.168.10",
@@ -89,22 +89,34 @@
89
89
  "vite": "^7.0.4"
90
90
  },
91
91
  "peerDependencies": {
92
+ "@joshwooding/vite-plugin-react-docgen-typescript": "^0.7.0",
92
93
  "@tanstack/react-router": "^1.168.10",
93
94
  "@tanstack/react-start": "^1.167.16",
94
95
  "@tanstack/router-core": "^1.168.9",
95
96
  "@tanstack/start-client-core": "^1.167.9",
96
97
  "react": "^18.0.0 || ^19.0.0",
98
+ "react-docgen": "^8.0.2",
99
+ "react-docgen-typescript": "^2.2.2",
97
100
  "react-dom": "^18.0.0 || ^19.0.0",
98
- "storybook": "^11.0.0-beta.0",
101
+ "storybook": "^11.0.0-beta.2",
99
102
  "typescript": "^5.9.0 || ^6.0.0 || ^7.0.0",
100
103
  "vite": "^6.3.0 || ^7.0.0 || ^8.0.0"
101
104
  },
102
105
  "peerDependenciesMeta": {
106
+ "@joshwooding/vite-plugin-react-docgen-typescript": {
107
+ "optional": true
108
+ },
103
109
  "@tanstack/react-start": {
104
110
  "optional": true
105
111
  },
106
112
  "@tanstack/start-client-core": {
107
113
  "optional": true
114
+ },
115
+ "react-docgen": {
116
+ "optional": true
117
+ },
118
+ "react-docgen-typescript": {
119
+ "optional": true
108
120
  }
109
121
  },
110
122
  "publishConfig": {
@@ -1,11 +1,11 @@
1
- import type { Meta, StoryObj } from '@storybook/tanstack-react';
1
+ import preview from '../../.storybook/preview';
2
2
 
3
3
  import { fn } from 'storybook/test';
4
4
 
5
5
  import { Button } from './Button';
6
6
 
7
7
  // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
8
- const meta = {
8
+ const meta = preview.meta({
9
9
  title: 'Example/Button',
10
10
  component: Button,
11
11
  parameters: {
@@ -20,35 +20,32 @@ const meta = {
20
20
  },
21
21
  // Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#story-args
22
22
  args: { onClick: fn() },
23
- } satisfies Meta<typeof Button>;
24
-
25
- export default meta;
26
- type Story = StoryObj<typeof meta>;
23
+ });
27
24
 
28
25
  // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
29
- export const Primary: Story = {
26
+ export const Primary = meta.story({
30
27
  args: {
31
28
  primary: true,
32
29
  label: 'Button',
33
30
  },
34
- };
31
+ });
35
32
 
36
- export const Secondary: Story = {
33
+ export const Secondary = meta.story({
37
34
  args: {
38
35
  label: 'Button',
39
36
  },
40
- };
37
+ });
41
38
 
42
- export const Large: Story = {
39
+ export const Large = meta.story({
43
40
  args: {
44
41
  size: 'large',
45
42
  label: 'Button',
46
43
  },
47
- };
44
+ });
48
45
 
49
- export const Small: Story = {
46
+ export const Small = meta.story({
50
47
  args: {
51
48
  size: 'small',
52
49
  label: 'Button',
53
50
  },
54
- };
51
+ });
@@ -1,10 +1,10 @@
1
- import type { Meta, StoryObj } from '@storybook/tanstack-react';
1
+ import preview from '../../.storybook/preview';
2
2
 
3
3
  import { fn } from 'storybook/test';
4
4
 
5
5
  import { Header } from './Header';
6
6
 
7
- const meta = {
7
+ const meta = preview.meta({
8
8
  title: 'Example/Header',
9
9
  component: Header,
10
10
  // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
@@ -18,17 +18,14 @@ const meta = {
18
18
  onLogout: fn(),
19
19
  onCreateAccount: fn(),
20
20
  },
21
- } satisfies Meta<typeof Header>;
21
+ });
22
22
 
23
- export default meta;
24
- type Story = StoryObj<typeof meta>;
25
-
26
- export const LoggedIn: Story = {
23
+ export const LoggedIn = meta.story({
27
24
  args: {
28
25
  user: {
29
26
  name: 'Jane Doe',
30
27
  },
31
28
  },
32
- };
29
+ });
33
30
 
34
- export const LoggedOut: Story = {};
31
+ export const LoggedOut = meta.story();
@@ -1,11 +1,11 @@
1
- import type { Meta, StoryObj } from '@storybook/tanstack-react';
1
+ import preview from '../../.storybook/preview';
2
2
 
3
3
  import { expect, userEvent, within } from 'storybook/test';
4
4
 
5
5
  import { Route } from './Page';
6
6
  import './page.css';
7
7
 
8
- const meta = {
8
+ const meta = preview.meta({
9
9
  title: 'Example/Page',
10
10
  parameters: {
11
11
  // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
@@ -19,15 +19,12 @@ const meta = {
19
19
  },
20
20
  },
21
21
  },
22
- } satisfies Meta<typeof Route>;
22
+ });
23
23
 
24
- export default meta;
25
- type Story = StoryObj<typeof meta>;
26
-
27
- export const LoggedOut: Story = {};
24
+ export const LoggedOut = meta.story();
28
25
 
29
26
  // More on component testing: https://storybook.js.org/docs/writing-tests/interaction-testing
30
- export const LoggedIn: Story = {
27
+ export const LoggedIn = meta.story({
31
28
  play: async ({ canvasElement }) => {
32
29
  const canvas = within(canvasElement);
33
30
  const loginButton = canvas.getByRole('button', { name: /Log in/i });
@@ -38,4 +35,4 @@ export const LoggedIn: Story = {
38
35
  const logoutButton = canvas.getByRole('button', { name: /Log out/i });
39
36
  await expect(logoutButton).toBeInTheDocument();
40
37
  },
41
- };
38
+ });