Sha256: c991179dbdce3c82fd3f1b9869864a1337c6418b9bc41b9abb899af2daf520c3
Contents?: true
Size: 809 Bytes
Versions: 26
Compression:
Stored size: 809 Bytes
Contents
/** * @vitest-environment jsdom */ import { getAbsoluteWorkerUrl } from './getAbsoluteWorkerUrl' const rawLocation = window.location afterAll(() => { Object.defineProperty(window, 'location', { value: rawLocation, }) }) it('returns absolute worker url relatively to the root', () => { expect(getAbsoluteWorkerUrl('./worker.js')).toBe('http://localhost/worker.js') }) it('returns an absolute worker url relatively to the current path', () => { Object.defineProperty(window, 'location', { value: { href: 'http://localhost/path/to/page', }, }) expect(getAbsoluteWorkerUrl('./worker.js')).toBe( 'http://localhost/path/to/worker.js', ) // Leading slash must still resolve to the root. expect(getAbsoluteWorkerUrl('/worker.js')).toBe('http://localhost/worker.js') })
Version data entries
26 entries across 26 versions & 1 rubygems