From 52acabbc23d1cbb2cbda63ecd1bb5e2705ae0d12 Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Thu, 19 Aug 2021 14:06:51 +1000 Subject: [PATCH] Fix addArgsHelpers test --- .../actions/src/preset/addArgsHelpers.test.ts | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/addons/actions/src/preset/addArgsHelpers.test.ts b/addons/actions/src/preset/addArgsHelpers.test.ts index ecece9bcae5..dd388ef3d66 100644 --- a/addons/actions/src/preset/addArgsHelpers.test.ts +++ b/addons/actions/src/preset/addArgsHelpers.test.ts @@ -8,7 +8,7 @@ describe('actions parameter enhancers', () => { it('should add actions that match a pattern', () => { const args = inferActionsFromArgTypesRegex(({ - args: {}, + initialArgs: {}, argTypes, parameters, } as unknown) as StoryContext); @@ -20,7 +20,7 @@ describe('actions parameter enhancers', () => { it('should NOT override pre-existing args', () => { const args = inferActionsFromArgTypesRegex(({ - args: { onClick: 'pre-existing value' }, + initialArgs: { onClick: 'pre-existing value' }, argTypes, parameters, } as unknown) as StoryContext); @@ -29,7 +29,7 @@ describe('actions parameter enhancers', () => { it('should NOT override pre-existing args, if null', () => { const args = inferActionsFromArgTypesRegex(({ - args: { onClick: null }, + initialArgs: { onClick: null }, argTypes, parameters, } as unknown) as StoryContext); @@ -38,7 +38,7 @@ describe('actions parameter enhancers', () => { it('should override pre-existing args, if undefined', () => { const args = inferActionsFromArgTypesRegex(({ - args: { onClick: undefined }, + initialArgs: { onClick: undefined }, argTypes, parameters, } as unknown) as StoryContext); @@ -47,7 +47,7 @@ describe('actions parameter enhancers', () => { it('should do nothing if actions are disabled', () => { const args = inferActionsFromArgTypesRegex(({ - args: {}, + initialArgs: {}, argTypes, parameters: { ...parameters, @@ -65,7 +65,11 @@ describe('actions parameter enhancers', () => { }; it('should add actions based on action.args', () => { expect( - addActionsFromArgTypes(({ args: {}, argTypes, parameters: {} } as unknown) as StoryContext) + addActionsFromArgTypes(({ + initialArgs: {}, + argTypes, + parameters: {}, + } as unknown) as StoryContext) ).toEqual({ onClick: expect.any(Function), onBlur: expect.any(Function), @@ -76,7 +80,7 @@ describe('actions parameter enhancers', () => { expect( addActionsFromArgTypes(({ argTypes: { onClick: { action: 'clicked!' } }, - args: { onClick: 'pre-existing value' }, + initialArgs: { onClick: 'pre-existing value' }, parameters: {}, } as unknown) as StoryContext) ).toEqual({}); @@ -86,7 +90,7 @@ describe('actions parameter enhancers', () => { expect( addActionsFromArgTypes(({ argTypes: { onClick: { action: 'clicked!' } }, - args: { onClick: null }, + initialArgs: { onClick: null }, parameters: {}, } as unknown) as StoryContext) ).toEqual({}); @@ -96,7 +100,7 @@ describe('actions parameter enhancers', () => { expect( addActionsFromArgTypes(({ argTypes: { onClick: { action: 'clicked!' } }, - args: { onClick: undefined }, + initialArgs: { onClick: undefined }, parameters: {}, } as unknown) as StoryContext) ).toEqual({ onClick: expect.any(Function) }); @@ -105,7 +109,7 @@ describe('actions parameter enhancers', () => { it('should do nothing if actions are disabled', () => { expect( addActionsFromArgTypes(({ - args: {}, + initialArgs: {}, argTypes, parameters: { actions: { disable: true } }, } as unknown) as StoryContext)