mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-07 05:12:31 +02:00
fix(core): codegen should generate unique route prop filenames (#10131)
This commit is contained in:
parent
394ce84691
commit
29b7a4ddbb
4 changed files with 152 additions and 25 deletions
|
@ -48,4 +48,30 @@ describe('docuHash', () => {
|
|||
expect(docuHash(file)).toBe(asserts[file]);
|
||||
});
|
||||
});
|
||||
|
||||
it('docuHash works with hashLength option', () => {
|
||||
const asserts: {[key: string]: string} = {
|
||||
'': '-d41d8',
|
||||
'/': 'index',
|
||||
'/foo-bar': 'foo-bar-09652',
|
||||
'/foo/bar': 'foo-bar-1df48',
|
||||
};
|
||||
Object.keys(asserts).forEach((file) => {
|
||||
expect(docuHash(file, {hashLength: 5})).toBe(asserts[file]);
|
||||
});
|
||||
});
|
||||
|
||||
it('docuHash works with hashExtra option', () => {
|
||||
expect(docuHash('')).toBe('-d41');
|
||||
expect(docuHash('', {hashExtra: ''})).toBe('-d41');
|
||||
expect(docuHash('', {hashExtra: 'some-extra'})).toBe('-928');
|
||||
|
||||
expect(docuHash('/')).toBe('index');
|
||||
expect(docuHash('/', {hashExtra: ''})).toBe('index-6a9');
|
||||
expect(docuHash('/', {hashExtra: 'some-extra'})).toBe('index-68e');
|
||||
|
||||
expect(docuHash('/foo/bar')).toBe('foo-bar-1df');
|
||||
expect(docuHash('/foo/bar', {hashExtra: ''})).toBe('foo-bar-1df');
|
||||
expect(docuHash('/foo/bar', {hashExtra: 'some-extra'})).toBe('foo-bar-7d4');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue