From 3c361d487720e0bc213cf046bd218015cdbc7576 Mon Sep 17 00:00:00 2001 From: Mateusz Kadlubowski Date: Fri, 6 Sep 2024 23:58:16 +0800 Subject: [PATCH] improve tests --- .../component-meta-to-define-meta.test.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/compiler/pre-transform/codemods/component-meta-to-define-meta.test.ts b/src/compiler/pre-transform/codemods/component-meta-to-define-meta.test.ts index 2770bc0..a2bb80c 100644 --- a/src/compiler/pre-transform/codemods/component-meta-to-define-meta.test.ts +++ b/src/compiler/pre-transform/codemods/component-meta-to-define-meta.test.ts @@ -134,12 +134,27 @@ describe(transformComponentMetaToDefineMeta.name, () => { import { Story } from "@storybook/addon-svelte-csf"; - + `; const component = await parseAndExtractSvelteNode(code, 'Component'); expect(print(transformComponentMetaToDefineMeta({ component }))).toMatchInlineSnapshot( - `"const { Story } = defineMeta({ tags: ["!dev"] });"` + `"const { Story } = defineMeta({ tags: ["singular"] });"` + ); + }); + + it('tags with an array expression are left as-is', async ({ expect }) => { + const code = ` + + + + `; + const component = await parseAndExtractSvelteNode(code, 'Component'); + + expect(print(transformComponentMetaToDefineMeta({ component }))).toMatchInlineSnapshot( + `"const { Story } = defineMeta({ tags: ["autodocs", "!dev"] });"` ); }); });