mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-09 00:19:13 +08:00
Add test for step runner composition
This commit is contained in:
parent
501b7e1b25
commit
118fe17652
@ -157,4 +157,22 @@ describe('composeConfigs', () => {
|
||||
runStep: expect.any(Function),
|
||||
});
|
||||
});
|
||||
|
||||
it('composes step runners', () => {
|
||||
const fn = jest.fn();
|
||||
|
||||
const { runStep } = composeConfigs([
|
||||
{ runStep: (label, play, context) => fn(`${label}1`, play(context)) },
|
||||
{ runStep: (label, play, context) => fn(`${label}2`, play(context)) },
|
||||
{ runStep: (label, play, context) => fn(`${label}3`, play(context)) },
|
||||
]);
|
||||
|
||||
// @ts-expect-error We don't care about the context value here
|
||||
runStep('Label', () => {}, {});
|
||||
|
||||
expect(fn).toHaveBeenCalledTimes(3);
|
||||
expect(fn).toHaveBeenNthCalledWith(1, 'Label3', expect.anything());
|
||||
expect(fn).toHaveBeenNthCalledWith(2, 'Label2', expect.anything());
|
||||
expect(fn).toHaveBeenNthCalledWith(3, 'Label1', expect.anything());
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user