Skip to content

Commit

Permalink
improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xeho91 committed Sep 6, 2024
1 parent 164e6e6 commit 3c361d4
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,27 @@ describe(transformComponentMetaToDefineMeta.name, () => {
import { Story } from "@storybook/addon-svelte-csf";
</script>
<Meta tags="!dev" />
<Meta tags="singular" />
`;
const component = await parseAndExtractSvelteNode<SvelteAST.Component>(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 = `
<script context="module">
import { Story } from "@storybook/addon-svelte-csf";
</script>
<Meta tags={["autodocs", "!dev"]} />
`;
const component = await parseAndExtractSvelteNode<SvelteAST.Component>(code, 'Component');

expect(print(transformComponentMetaToDefineMeta({ component }))).toMatchInlineSnapshot(
`"const { Story } = defineMeta({ tags: ["autodocs", "!dev"] });"`
);
});
});

0 comments on commit 3c361d4

Please sign in to comment.