Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autodocs: Fix docs pages ignoring meta.id when calculating their ID #23520

Merged
merged 10 commits into from
Aug 1, 2023
177 changes: 177 additions & 0 deletions code/lib/core-server/src/utils/StoryIndexGenerator.test.ts
Expand Up @@ -89,6 +89,13 @@ describe('StoryIndexGenerator', () => {
"a--story-one": Object {
"id": "a--story-one",
"importPath": "./src/A.stories.js",
"meta": Object {
"component": "component",
"tags": Array [
"component-tag",
],
"title": "A",
},
"name": "Story One",
"tags": Array [
"story-tag",
Expand Down Expand Up @@ -119,6 +126,13 @@ describe('StoryIndexGenerator', () => {
"nested-button--story-one": Object {
"id": "nested-button--story-one",
"importPath": "./src/nested/Button.stories.ts",
"meta": Object {
"component": "component",
"tags": Array [
"component-tag",
],
"title": "nested/Button",
},
"name": "Story One",
"tags": Array [
"component-tag",
Expand All @@ -130,6 +144,10 @@ describe('StoryIndexGenerator', () => {
"second-nested-g--story-one": Object {
"id": "second-nested-g--story-one",
"importPath": "./src/second-nested/G.stories.ts",
"meta": Object {
"component": "component",
"title": "second-nested/G",
},
"name": "Story One",
"tags": Array [
"story",
Expand Down Expand Up @@ -160,6 +178,13 @@ describe('StoryIndexGenerator', () => {
"a--story-one": Object {
"id": "a--story-one",
"importPath": "./src/A.stories.js",
"meta": Object {
"component": "component",
"tags": Array [
"component-tag",
],
"title": "A",
},
"name": "Story One",
"tags": Array [
"story-tag",
Expand All @@ -171,6 +196,13 @@ describe('StoryIndexGenerator', () => {
"b--story-one": Object {
"id": "b--story-one",
"importPath": "./src/B.stories.ts",
"meta": Object {
"component": "component",
"tags": Array [
"autodocs",
],
"title": "B",
},
"name": "Story One",
"tags": Array [
"autodocs",
Expand All @@ -182,6 +214,13 @@ describe('StoryIndexGenerator', () => {
"d--story-one": Object {
"id": "d--story-one",
"importPath": "./src/D.stories.jsx",
"meta": Object {
"component": "component",
"tags": Array [
"autodocs",
],
"title": "D",
},
"name": "Story One",
"tags": Array [
"autodocs",
Expand All @@ -193,6 +232,10 @@ describe('StoryIndexGenerator', () => {
"first-nested-deeply-f--story-one": Object {
"id": "first-nested-deeply-f--story-one",
"importPath": "./src/first-nested/deeply/F.stories.js",
"meta": Object {
"component": "component",
"title": "first-nested/deeply/F",
},
"name": "Story One",
"tags": Array [
"story",
Expand All @@ -203,6 +246,13 @@ describe('StoryIndexGenerator', () => {
"h--story-one": Object {
"id": "h--story-one",
"importPath": "./src/H.stories.mjs",
"meta": Object {
"component": "component",
"tags": Array [
"autodocs",
],
"title": "H",
},
"name": "Story One",
"tags": Array [
"autodocs",
Expand All @@ -214,6 +264,13 @@ describe('StoryIndexGenerator', () => {
"nested-button--story-one": Object {
"id": "nested-button--story-one",
"importPath": "./src/nested/Button.stories.ts",
"meta": Object {
"component": "component",
"tags": Array [
"component-tag",
],
"title": "nested/Button",
},
"name": "Story One",
"tags": Array [
"component-tag",
Expand All @@ -225,6 +282,10 @@ describe('StoryIndexGenerator', () => {
"second-nested-g--story-one": Object {
"id": "second-nested-g--story-one",
"importPath": "./src/second-nested/G.stories.ts",
"meta": Object {
"component": "component",
"title": "second-nested/G",
},
"name": "Story One",
"tags": Array [
"story",
Expand Down Expand Up @@ -269,6 +330,16 @@ describe('StoryIndexGenerator', () => {
"page--story-one": Object {
"id": "page--story-one",
"importPath": "./src/nested/Page.stories.mdx",
"meta": Object {
"component": "{}",
"includeStories": Array [
"storyOne",
],
"tags": Array [
"stories-mdx",
],
"title": "Page",
},
"name": "StoryOne",
"tags": Array [
"stories-mdx",
Expand Down Expand Up @@ -304,6 +375,13 @@ describe('StoryIndexGenerator', () => {
"a--story-one": Object {
"id": "a--story-one",
"importPath": "./src/A.stories.js",
"meta": Object {
"component": "component",
"tags": Array [
"component-tag",
],
"title": "A",
},
"name": "Story One",
"tags": Array [
"story-tag",
Expand All @@ -327,6 +405,13 @@ describe('StoryIndexGenerator', () => {
"b--story-one": Object {
"id": "b--story-one",
"importPath": "./src/B.stories.ts",
"meta": Object {
"component": "component",
"tags": Array [
"autodocs",
],
"title": "B",
},
"name": "Story One",
"tags": Array [
"autodocs",
Expand All @@ -350,6 +435,13 @@ describe('StoryIndexGenerator', () => {
"d--story-one": Object {
"id": "d--story-one",
"importPath": "./src/D.stories.jsx",
"meta": Object {
"component": "component",
"tags": Array [
"autodocs",
],
"title": "D",
},
"name": "Story One",
"tags": Array [
"autodocs",
Expand All @@ -361,6 +453,10 @@ describe('StoryIndexGenerator', () => {
"first-nested-deeply-f--story-one": Object {
"id": "first-nested-deeply-f--story-one",
"importPath": "./src/first-nested/deeply/F.stories.js",
"meta": Object {
"component": "component",
"title": "first-nested/deeply/F",
},
"name": "Story One",
"tags": Array [
"story",
Expand All @@ -383,6 +479,13 @@ describe('StoryIndexGenerator', () => {
"h--story-one": Object {
"id": "h--story-one",
"importPath": "./src/H.stories.mjs",
"meta": Object {
"component": "component",
"tags": Array [
"autodocs",
],
"title": "H",
},
"name": "Story One",
"tags": Array [
"autodocs",
Expand All @@ -394,6 +497,13 @@ describe('StoryIndexGenerator', () => {
"nested-button--story-one": Object {
"id": "nested-button--story-one",
"importPath": "./src/nested/Button.stories.ts",
"meta": Object {
"component": "component",
"tags": Array [
"component-tag",
],
"title": "nested/Button",
},
"name": "Story One",
"tags": Array [
"component-tag",
Expand All @@ -405,6 +515,10 @@ describe('StoryIndexGenerator', () => {
"second-nested-g--story-one": Object {
"id": "second-nested-g--story-one",
"importPath": "./src/second-nested/G.stories.ts",
"meta": Object {
"component": "component",
"title": "second-nested/G",
},
"name": "Story One",
"tags": Array [
"story",
Expand Down Expand Up @@ -553,6 +667,13 @@ describe('StoryIndexGenerator', () => {
"b--story-one": Object {
"id": "b--story-one",
"importPath": "./src/B.stories.ts",
"meta": Object {
"component": "component",
"tags": Array [
"autodocs",
],
"title": "B",
},
"name": "Story One",
"tags": Array [
"autodocs",
Expand Down Expand Up @@ -612,6 +733,13 @@ describe('StoryIndexGenerator', () => {
"b--story-one": Object {
"id": "b--story-one",
"importPath": "./src/B.stories.ts",
"meta": Object {
"component": "component",
"tags": Array [
"autodocs",
],
"title": "B",
},
"name": "Story One",
"tags": Array [
"autodocs",
Expand Down Expand Up @@ -663,6 +791,13 @@ describe('StoryIndexGenerator', () => {
"a--story-one": Object {
"id": "a--story-one",
"importPath": "./src/A.stories.js",
"meta": Object {
"component": "component",
"tags": Array [
"component-tag",
],
"title": "A",
},
"name": "Story One",
"tags": Array [
"story-tag",
Expand Down Expand Up @@ -706,6 +841,13 @@ describe('StoryIndexGenerator', () => {
"duplicate-a--story-one": Object {
"id": "duplicate-a--story-one",
"importPath": "./duplicate/A.stories.js",
"meta": Object {
"component": "component",
"tags": Array [
"autodocs",
],
"title": "duplicate/A",
},
"name": "Story One",
"tags": Array [
"autodocs",
Expand All @@ -717,6 +859,13 @@ describe('StoryIndexGenerator', () => {
"duplicate-a--story-two": Object {
"id": "duplicate-a--story-two",
"importPath": "./duplicate/SecondA.stories.js",
"meta": Object {
"component": "component",
"tags": Array [
"autodocs",
],
"title": "duplicate/A",
},
"name": "Story Two",
"tags": Array [
"autodocs",
Expand Down Expand Up @@ -789,6 +938,13 @@ describe('StoryIndexGenerator', () => {
"a--story-one": Object {
"id": "a--story-one",
"importPath": "./src/A.stories.js",
"meta": Object {
"component": "component",
"tags": Array [
"component-tag",
],
"title": "A",
},
"name": "Story One",
"tags": Array [
"story-tag",
Expand Down Expand Up @@ -911,6 +1067,13 @@ describe('StoryIndexGenerator', () => {
"a--story-one": Object {
"id": "a--story-one",
"importPath": "./src/A.stories.js",
"meta": Object {
"component": "component",
"tags": Array [
"component-tag",
],
"title": "A",
},
"name": "Story One",
"tags": Array [
"story-tag",
Expand Down Expand Up @@ -977,6 +1140,13 @@ describe('StoryIndexGenerator', () => {
"a--story-one": Object {
"id": "a--story-one",
"importPath": "./src/A.stories.js",
"meta": Object {
"component": "component",
"tags": Array [
"component-tag",
],
"title": "A",
},
"name": "Story One",
"tags": Array [
"story-tag",
Expand All @@ -988,6 +1158,13 @@ describe('StoryIndexGenerator', () => {
"b--story-one": Object {
"id": "b--story-one",
"importPath": "./src/B.stories.ts",
"meta": Object {
"component": "component",
"tags": Array [
"autodocs",
],
"title": "B",
},
"name": "Story One",
"tags": Array [
"autodocs",
Expand Down