Skip to content

Commit

Permalink
use port 80 like jest
Browse files Browse the repository at this point in the history
  • Loading branch information
birkskyum committed Sep 21, 2024
1 parent 5344b53 commit 4b1f74e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 deletions.
44 changes: 22 additions & 22 deletions src/ui/hash.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,69 +329,69 @@ describe('hash', () => {
expect(window.location.hash).toBe('#baz&foo=bar');
});

test('initialize http://localhost:3000/#', () => {
window.location.href = 'http://localhost:3000/#';
test('initialize http://localhost/#', () => {
window.location.href = 'http://localhost/#';
createHash().addTo(map);
map.setZoom(3);
expect(window.location.hash).toBe('#3/0/0');
expect(window.location.href).toBe('http://localhost:3000/#3/0/0');
expect(window.location.href).toBe('http://localhost/#3/0/0');
map.setCenter([2.0, 1.0]);
expect(window.location.hash).toBe('#3/1/2');
expect(window.location.href).toBe('http://localhost:3000/#3/1/2');
expect(window.location.href).toBe('http://localhost/#3/1/2');
});

test('initialize http://localhost:3000/##', () => {
window.location.href = 'http://localhost:3000/##';
test('initialize http://localhost/##', () => {
window.location.href = 'http://localhost/##';
createHash().addTo(map);
map.setZoom(3);
expect(window.location.hash).toBe('#3/0/0');
expect(window.location.href).toBe('http://localhost:3000/#3/0/0');
expect(window.location.href).toBe('http://localhost/#3/0/0');
map.setCenter([2.0, 1.0]);
expect(window.location.hash).toBe('#3/1/2');
expect(window.location.href).toBe('http://localhost:3000/#3/1/2');
expect(window.location.href).toBe('http://localhost/#3/1/2');
});

test('initialize http://localhost:3000#', () => {
window.location.href = 'http://localhost:3000#';
test('initialize http://localhost#', () => {
window.location.href = 'http://localhost#';
createHash().addTo(map);
map.setZoom(4);
expect(window.location.hash).toBe('#4/0/0');
expect(window.location.href).toBe('http://localhost:3000/#4/0/0');
expect(window.location.href).toBe('http://localhost/#4/0/0');
map.setCenter([2.0, 1.0]);
expect(window.location.hash).toBe('#4/1/2');
expect(window.location.href).toBe('http://localhost:3000/#4/1/2');
expect(window.location.href).toBe('http://localhost/#4/1/2');
});

test('initialize http://localhost:3000/', () => {
window.location.href = 'http://localhost:3000/';
test('initialize http://localhost/', () => {
window.location.href = 'http://localhost/';
createHash().addTo(map);
map.setZoom(5);
expect(window.location.hash).toBe('#5/0/0');
expect(window.location.href).toBe('http://localhost:3000/#5/0/0');
expect(window.location.href).toBe('http://localhost/#5/0/0');
map.setCenter([2.0, 1.0]);
expect(window.location.hash).toBe('#5/1/2');
expect(window.location.href).toBe('http://localhost:3000/#5/1/2');
expect(window.location.href).toBe('http://localhost/#5/1/2');
});

test('initialize default value for window.location.href', () => {
createHash().addTo(map);
map.setZoom(5);
expect(window.location.hash).toBe('#5/0/0');
expect(window.location.href).toBe('http://localhost:3000/#5/0/0');
expect(window.location.href).toBe('http://localhost/#5/0/0');
map.setCenter([2.0, 1.0]);
expect(window.location.hash).toBe('#5/1/2');
expect(window.location.href).toBe('http://localhost:3000/#5/1/2');
expect(window.location.href).toBe('http://localhost/#5/1/2');
});

test('initialize http://localhost:3000', () => {
window.location.href = 'http://localhost:3000';
test('initialize http://localhost', () => {
window.location.href = 'http://localhost';
createHash().addTo(map);
map.setZoom(4);
expect(window.location.hash).toBe('#4/0/0');
expect(window.location.href).toBe('http://localhost:3000/#4/0/0');
expect(window.location.href).toBe('http://localhost/#4/0/0');
map.setCenter([2.0, 1.0]);
expect(window.location.hash).toBe('#4/1/2');
expect(window.location.href).toBe('http://localhost:3000/#4/1/2');
expect(window.location.href).toBe('http://localhost/#4/1/2');
});

test('map#remove', () => {
Expand Down
5 changes: 5 additions & 0 deletions vitest.config.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ export default defineConfig({
test: {
name: 'unit',
environment: 'jsdom',
environmentOptions: {
jsdom: {
url: 'http://localhost/',
}
},
setupFiles: [
'vitest-webgl-canvas-mock',
'./test/unit/lib/web_worker_mock.ts'
Expand Down

0 comments on commit 4b1f74e

Please sign in to comment.