Skip to content

Commit 816b043

Browse files
author
Nikos Katsikanis
committed
test
1 parent 8289cdd commit 816b043

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

js/config.test.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,24 @@ describe('config.js', () => {
1414
window.location = originalLocation;
1515
});
1616

17-
it('should return empty prefix for localhost', async () => {
17+
it('should return /js for localhost', async () => {
1818
// @ts-ignore
1919
window.location = { hostname: 'localhost' };
2020
const config = (await import('../js/config.js')).default;
2121
expect(config.BASE_URL).toBe('/js');
2222
});
2323

24-
it('should return /vanillajs-patterns prefix for non-localhost', async () => {
24+
it('should return /vanillajs-patterns/js for GitHub Pages host', async () => {
2525
// @ts-ignore
26-
window.location = { hostname: 'example.com' };
26+
window.location = { hostname: 'quantuminformation.github.io' };
2727
const config = (await import('../js/config.js')).default;
2828
expect(config.BASE_URL).toBe('/vanillajs-patterns/js');
2929
});
30+
31+
it('should return /js for other non-localhost domains', async () => {
32+
// @ts-ignore
33+
window.location = { hostname: 'example.com' };
34+
const config = (await import('../js/config.js')).default;
35+
expect(config.BASE_URL).toBe('/js');
36+
});
3037
});

0 commit comments

Comments
 (0)