From 16424837a89baa8d08d59600a8c498fdf75144ed Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Sun, 26 Jun 2022 22:06:59 +1000 Subject: [PATCH] Added test for disabling --- examples/react-ts/.storybook/main.ts | 5 ---- .../src/utils/StoryIndexGenerator.test.ts | 25 +++++++++++++++++++ 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/examples/react-ts/.storybook/main.ts b/examples/react-ts/.storybook/main.ts index 3d73fd524a65..bdf1d107d643 100644 --- a/examples/react-ts/.storybook/main.ts +++ b/examples/react-ts/.storybook/main.ts @@ -23,11 +23,6 @@ const config: StorybookConfig = { '@storybook/addon-storyshots', '@storybook/addon-a11y', ], - docs: { - // enabled: false, - defaultName: 'Info', - // docsPage: false, - }, typescript: { check: true, checkOptions: {}, diff --git a/lib/core-server/src/utils/StoryIndexGenerator.test.ts b/lib/core-server/src/utils/StoryIndexGenerator.test.ts index a8e5be950184..6929a9573a51 100644 --- a/lib/core-server/src/utils/StoryIndexGenerator.test.ts +++ b/lib/core-server/src/utils/StoryIndexGenerator.test.ts @@ -237,6 +237,31 @@ describe('StoryIndexGenerator', () => { ); }); + it('generates no docs entries when docs are disabled', async () => { + const generator = new StoryIndexGenerator([storiesSpecifier, docsSpecifier], { + ...options, + docs: { + ...options.docs, + enabled: false, + }, + }); + await generator.initialize(); + + expect(await generator.getIndex()).toMatchInlineSnapshot(` + Object { + "entries": Object { + "a--story-one": Object { + "id": "a--story-one", + "importPath": "./src/A.stories.js", + "name": "Story One", + "title": "A", + "type": "story", + }, + }, + "v": 4, + } + `); + }); it('Allows you to override default name for docs files', async () => { const generator = new StoryIndexGenerator([storiesSpecifier, docsSpecifier], { ...options,