-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: index path for category type pages
- Loading branch information
1 parent
24679a6
commit 91d4540
Showing
5 changed files
with
95 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { | ||
getDefaultStore, | ||
defaultBuildConfig, | ||
defaultRunConfig, | ||
deepMerge, | ||
Store, | ||
} from '@component-controls/core'; | ||
import { getHomePages } from '../src/routes'; | ||
|
||
describe('category-routes', () => { | ||
const store: Store = { | ||
...getDefaultStore(), | ||
...{ | ||
config: deepMerge(defaultBuildConfig, defaultRunConfig), | ||
docs: { | ||
'doc/doc-1': { | ||
title: 'doc/doc-1', | ||
tags: ['tag-1'], | ||
stories: ['story-1', 'story-2'], | ||
}, | ||
'doc/doc-2': { | ||
title: 'doc/doc-2', | ||
tags: ['tag-1', 'tag-2'], | ||
stories: ['story-3', 'story-4'], | ||
}, | ||
}, | ||
stories: {}, | ||
}, | ||
}; | ||
it('tags pages', () => { | ||
const paths = getHomePages(store); | ||
|
||
expect(paths[0]).toMatchObject({ | ||
docId: 'doc/doc-1', | ||
path: '/docs', | ||
storyId: 'story-1', | ||
type: 'story', | ||
}); | ||
expect(paths[1]).toMatchObject({ | ||
docId: undefined, | ||
path: '/tags', | ||
storyId: undefined, | ||
type: 'tags', | ||
}); | ||
}); | ||
it('tags pages with siteRoot', () => { | ||
const paths = getHomePages({ | ||
...store, | ||
config: { ...store.config, siteRoot: '/root/' }, | ||
}); | ||
|
||
expect(paths[0]).toMatchObject({ | ||
docId: 'doc/doc-1', | ||
path: '/root/docs', | ||
storyId: 'story-1', | ||
type: 'story', | ||
}); | ||
expect(paths[1]).toMatchObject({ | ||
docId: undefined, | ||
path: '/root/tags', | ||
storyId: undefined, | ||
type: 'tags', | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters