mirror of
https://github.com/docsifyjs/docsify.git
synced 2026-10-17 04:31:18 +08:00
fix: When alias contains parameters, append ext error (#1855)
This commit is contained in:
@@ -66,4 +66,35 @@ describe('router/history/base', () => {
|
||||
expect(url).toBe('/README');
|
||||
});
|
||||
});
|
||||
|
||||
// getFile test
|
||||
// ---------------------------------------------------------------------------
|
||||
describe('getFile', () => {
|
||||
// Tests
|
||||
// -------------------------------------------------------------------------
|
||||
test('path is url', () => {
|
||||
const file = history.getFile('https://some/raw/url/README.md');
|
||||
|
||||
expect(file).toBe('https://some/raw/url/README.md');
|
||||
});
|
||||
test('path is url, but ext is .html', () => {
|
||||
const file = history.getFile('https://foo.com/index.html');
|
||||
|
||||
expect(file).toBe('https://foo.com/index.html');
|
||||
});
|
||||
test('path is url, but with parameters', () => {
|
||||
const file = history.getFile(
|
||||
'https://some/raw/url/README.md?token=Mytoken',
|
||||
);
|
||||
|
||||
expect(file).toBe('https://some/raw/url/README.md?token=Mytoken');
|
||||
});
|
||||
test('path is url, but ext is different', () => {
|
||||
history = new MockHistory({ ext: '.ext' });
|
||||
|
||||
const file = history.getFile('https://some/raw/url/README.md');
|
||||
|
||||
expect(file).toBe('https://some/raw/url/README.md.ext');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user