-
Notifications
You must be signed in to change notification settings - Fork 45
/
RestaurantDetailPage.stories.tsx
53 lines (48 loc) · 1.29 KB
/
RestaurantDetailPage.stories.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { Meta, StoryObj } from '@storybook/react'
import { rest } from 'msw'
import { expect } from '@storybook/test'
import { BASE_URL } from '../../api'
import { restaurants } from '../../stub/restaurants'
import { cartItems } from '../../stub/cart-items'
import { withDeeplink } from '../../../.storybook/withDeeplink'
import { RestaurantDetailPage } from './RestaurantDetailPage'
const meta = {
title: 'Pages/RestaurantDetailPage',
component: RestaurantDetailPage,
decorators: [withDeeplink],
parameters: {
layout: 'fullscreen',
deeplink: {
route: '/restaurants/1',
path: '/restaurants/:id',
},
},
render: () => {
return (
<>
<RestaurantDetailPage />
<div id="modal" />
</>
)
},
} satisfies Meta<typeof RestaurantDetailPage>
export default meta
type Story = StoryObj<typeof meta>
export const Success: Story = {
parameters: {
design: {
type: 'figma',
url: 'https://www.figma.com/file/3Q1HTCalD0lJnNvcMoEw1x/Mealdrop?node-id=169%3A510',
},
msw: [
rest.get(BASE_URL, (req, res, ctx) => {
return res(ctx.json(restaurants[0]))
}),
],
},
play: async () => {
// fails with this but it could be any import
// for instance within() would fail similarly
expect(1).toBe(1)
},
}