diff --git a/code/lib/cli-storybook/src/automigrate/fixes/vite-config-file.test.ts b/code/lib/cli-storybook/src/automigrate/fixes/vite-config-file.test.ts new file mode 100644 index 000000000000..377e754e6b9b --- /dev/null +++ b/code/lib/cli-storybook/src/automigrate/fixes/vite-config-file.test.ts @@ -0,0 +1,48 @@ +import { describe, expect, it } from 'vitest'; + +import type { StorybookConfig } from 'storybook/internal/types'; + +import { viteConfigFile } from './vite-config-file'; + +const check = async ({ + packageManager, + main: mainConfig, + storybookVersion = '8.0.0', +}: { + packageManager: any; + main: Partial & Record; + storybookVersion?: string; +}) => { + return viteConfigFile.check({ + packageManager, + configDir: '', + mainConfig: mainConfig as any, + storybookVersion, + }); +}; + +describe('no-ops', () => { + it('skips when react-native-web-vite', async () => { + await expect( + check({ + packageManager: {}, + main: { + framework: '@storybook/react-native-web-vite', + }, + }) + ).resolves.toBeFalsy(); + }); +}); + +describe('continue', () => { + it('executes for vite framework', async () => { + await expect( + check({ + packageManager: {}, + main: { + framework: '@storybook/react-vite', + }, + }) + ).resolves.toBeTruthy(); + }); +});