How to use makeStoryIndex method in storybook-root

Best JavaScript code snippet using storybook-root

StoryIndexStore.test.ts

Source:StoryIndexStore.test.ts Github

copy

Full Screen

...43 const store = new StoryIndexStore(storyIndex);44 expect(store.storyIdFromSpecifier('*')).toEqual('component-one--a');45 });46 it('selects nothing if there are no stories', async () => {47 const store = new StoryIndexStore(makeStoryIndex([]));48 expect(store.storyIdFromSpecifier('*')).toBeUndefined();49 });50 });51 describe('if you use a component or group id', () => {52 it('selects the first story for the component', async () => {53 const store = new StoryIndexStore(storyIndex);54 expect(store.storyIdFromSpecifier('component-two')).toEqual('component-two--c');55 });56 it('selects the first story for the group', async () => {57 const store = new StoryIndexStore(58 makeStoryIndex([59 ['g1/a', '1'],60 ['g2/a', '1'],61 ['g2/b', '1'],62 ])63 );64 expect(store.storyIdFromSpecifier('g2')).toEqual('g2-a--1');65 });66 // Making sure the fix #11571 doesn't break this67 it('selects the first story if there are two stories in the group of different lengths', async () => {68 const store = new StoryIndexStore(69 makeStoryIndex([70 ['a', 'long-long-long'],71 ['a', 'short'],72 ])73 );74 expect(store.storyIdFromSpecifier('a')).toEqual('a--long-long-long');75 });76 it('selects nothing if the component or group does not exist', async () => {77 const store = new StoryIndexStore(storyIndex);78 expect(store.storyIdFromSpecifier('random')).toBeUndefined();79 });80 });81 describe('if you use a storyId', () => {82 it('selects a specific story', async () => {83 const store = new StoryIndexStore(storyIndex);84 expect(store.storyIdFromSpecifier('component-one--a')).toEqual('component-one--a');85 });86 it('selects nothing if you the story does not exist', async () => {87 const store = new StoryIndexStore(storyIndex);88 expect(store.storyIdFromSpecifier('component-one--c')).toBeUndefined();89 });90 // See #1157191 it('does NOT select an earlier story that this story id is a prefix of', async () => {92 const store = new StoryIndexStore(93 makeStoryIndex([94 ['a', '31'],95 ['a', '3'],96 ])97 );98 expect(store.storyIdFromSpecifier('a--3')).toEqual('a--3');99 });100 });101 });102 describe('storyIdToEntry', () => {103 it('works when the story exists', async () => {104 const store = new StoryIndexStore(storyIndex);105 expect(store.storyIdToEntry('component-one--a')).toEqual({106 name: 'A',107 title: 'Component One',...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run storybook-root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful