mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 02:01:48 +08:00
Fix windows tests for normalizeStoryPath
This commit is contained in:
parent
595ce8a450
commit
e65bd0ecb7
@ -3,54 +3,27 @@ import { normalizeStoryPath } from '../paths';
|
||||
|
||||
describe('paths - normalizeStoryPath()', () => {
|
||||
it('returns a path starting with "./" unchanged', () => {
|
||||
const filename = `./src/Comp.story.js`;
|
||||
const filename = `.${path.sep}${path.join('src', 'Comp.story.js')}`;
|
||||
expect(normalizeStoryPath(filename)).toEqual(filename);
|
||||
});
|
||||
|
||||
it('returns a path starting with "../" unchanged', () => {
|
||||
const filename = `../src/Comp.story.js`;
|
||||
const filename = path.join('..', 'src', 'Comp.story.js');
|
||||
expect(normalizeStoryPath(filename)).toEqual(filename);
|
||||
});
|
||||
|
||||
it('adds "./" to a normalized relative path', () => {
|
||||
const filename = `src/Comp.story.js`;
|
||||
expect(normalizeStoryPath(filename)).toEqual(`./${filename}`);
|
||||
const filename = path.join('src', 'Comp.story.js');
|
||||
expect(normalizeStoryPath(filename)).toEqual(`.${path.sep}${filename}`);
|
||||
});
|
||||
|
||||
it('adds "./" to a hidden folder', () => {
|
||||
const filename = `.storybook/Comp.story.js`;
|
||||
expect(normalizeStoryPath(filename)).toEqual(`./${filename}`);
|
||||
const filename = path.join('.storybook', 'Comp.story.js');
|
||||
expect(normalizeStoryPath(filename)).toEqual(`.${path.sep}${filename}`);
|
||||
});
|
||||
|
||||
it('adds "./" to a hidden file', () => {
|
||||
const filename = `.Comp.story.js`;
|
||||
expect(normalizeStoryPath(filename)).toEqual(`./${filename}`);
|
||||
});
|
||||
|
||||
describe('windows paths', () => {
|
||||
it('returns a path starting with ".\\" unchanged', () => {
|
||||
const filename = `.\\src\\Comp.story.js`;
|
||||
expect(normalizeStoryPath(filename)).toEqual(filename);
|
||||
});
|
||||
|
||||
it('returns a path starting with "..\\" unchanged', () => {
|
||||
const filename = `..\\src\\Comp.story.js`;
|
||||
expect(normalizeStoryPath(filename)).toEqual(filename);
|
||||
});
|
||||
|
||||
it('adds ".{path.sep}" to a normalized relative path', () => {
|
||||
const filename = `src\\Comp.story.js`;
|
||||
expect(normalizeStoryPath(filename)).toEqual(`.${path.sep}${filename}`);
|
||||
});
|
||||
|
||||
it('adds ".{path.sep}" to a hidden folder', () => {
|
||||
const filename = `.storybook\\Comp.story.js`;
|
||||
expect(normalizeStoryPath(filename)).toEqual(`.${path.sep}${filename}`);
|
||||
});
|
||||
|
||||
it('adds ".{path.sep}" to a hidden file', () => {
|
||||
const filename = `.Comp.story.js`;
|
||||
expect(normalizeStoryPath(filename)).toEqual(`.${path.sep}${filename}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user