11import type { Meta , StoryObj } from '@storybook/react-webpack5' ;
2+ import { fn , within } from 'storybook/test' ;
23import { parse } from 'valibot' ;
3- import { ukNav } from '../../../fixtures/manual/appsNav/uk' ;
44import { auNav } from '../../../fixtures/manual/appsNav/au' ;
5- import { AppsNavSchema , type AppsNav } from './appsNav' ;
6- import { AppsNavTool , PublishResult } from './AppsNavTool' ;
7- import { fn , within } from 'storybook/test' ;
5+ import { ukNav } from '../../../fixtures/manual/appsNav/uk' ;
86import { error , ok } from '../../lib/result' ;
7+ import { AppsNavSchema } from './appsNav' ;
8+ import type { PublishResult } from './AppsNavTool' ;
9+ import { AppsNavTool } from './AppsNavTool' ;
910
1011const meta = {
1112 title : 'Admin/Apps Nav Tool' ,
@@ -21,9 +22,7 @@ export const UKNav = {
2122 nav : parse ( AppsNavSchema , ukNav ) ,
2223 editionId : 'UK' ,
2324 guardianBaseUrl : 'https://www.theguardian.com' ,
24- publish : fn ( ( _data : AppsNav ) =>
25- Promise . resolve < PublishResult > ( ok ( true ) ) ,
26- ) ,
25+ publish : fn ( ( ) => Promise . resolve < PublishResult > ( ok ( true ) ) ) ,
2726 } ,
2827} satisfies Story ;
2928
@@ -37,21 +36,21 @@ export const AUNav = {
3736
3837export const AddSectionForm = {
3938 ...UKNav ,
40- play : ( { canvas, userEvent } ) => {
39+ play : async ( { canvas, userEvent } ) => {
4140 const addSection = canvas . getByRole ( 'button' , { name : 'Add Section' } ) ;
4241
43- userEvent . click ( addSection ) ;
42+ await userEvent . click ( addSection ) ;
4443 } ,
4544} satisfies Story ;
4645
4746export const EditSectionForm = {
4847 ...UKNav ,
49- play : ( { canvas, userEvent } ) => {
48+ play : async ( { canvas, userEvent } ) => {
5049 // ! is used here to make sure we get an error in storybook if this
5150 // can't be found.
5251 const addSection = canvas . getAllByRole ( 'button' , { name : 'Edit' } ) [ 0 ] ! ;
5352
54- userEvent . click ( addSection ) ;
53+ await userEvent . click ( addSection ) ;
5554 } ,
5655} satisfies Story ;
5756
@@ -147,7 +146,7 @@ export const PublishConfirm = {
147146export const PublishError = {
148147 args : {
149148 ...UKNav . args ,
150- publish : fn ( ( _data : AppsNav ) =>
149+ publish : fn ( ( ) =>
151150 Promise . resolve < PublishResult > ( error ( 'NetworkError' ) ) ,
152151 ) ,
153152 } ,
0 commit comments