Skip to content

Commit 0e3c8e3

Browse files
committed
test: add test for history.getFile
1 parent 561c777 commit 0e3c8e3

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/unit/router-history-base.test.js

+31
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,35 @@ describe('router/history/base', () => {
6666
expect(url).toBe('/README');
6767
});
6868
});
69+
70+
// alias: uri
71+
// ---------------------------------------------------------------------------
72+
describe('getFile', () => {
73+
// Tests
74+
// -------------------------------------------------------------------------
75+
test('path is url', () => {
76+
const file = history.getFile('https://some/raw/url/README.md');
77+
78+
expect(file).toBe('https://some/raw/url/README.md');
79+
});
80+
test('path is url, but ext is .html', () => {
81+
const file = history.getFile('https://foo.com/index.html');
82+
83+
expect(file).toBe('https://foo.com/index.html');
84+
});
85+
test('path is url, bug with parameters', () => {
86+
const file = history.getFile(
87+
'https://some/raw/url/README.md?token=Mytoken'
88+
);
89+
90+
expect(file).toBe('https://some/raw/url/README.md?token=Mytoken');
91+
});
92+
test('path is url, but ext is different', () => {
93+
history = new MockHistory({ ext: '.ext' });
94+
95+
const file = history.getFile('https://some/raw/url/README.md');
96+
97+
expect(file).toBe('https://some/raw/url/README.md.ext');
98+
});
99+
});
69100
});

0 commit comments

Comments
 (0)