-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
26845be
commit 481de43
Showing
7 changed files
with
36 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { describe, expect, test, vi } from 'vitest' | ||
import { random } from '.' | ||
import { getInitialUrl } from '@/utilities/getInitialUrl' | ||
|
||
describe('getInitialUrl', () => { | ||
test('given value for initial route, returns value', () => { | ||
const initialRoute = random.number().toString() | ||
|
||
const response = getInitialUrl(initialRoute) | ||
|
||
|
||
expect(response).toBe(initialRoute) | ||
}) | ||
|
||
test('defaults to window.location', () => { | ||
const initialRoute = random.number().toString() | ||
vi.stubGlobal('location', initialRoute) | ||
|
||
const response = getInitialUrl() | ||
|
||
expect(response).toBe(initialRoute) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { describe, expect, test } from 'vitest' | ||
import { getInitialUrl } from '@/utilities/getInitialUrl' | ||
|
||
describe('getInitialUrl', () => { | ||
test('throws error if initial route is not set', () => { | ||
expect(() => getInitialUrl()).toThrowError('initialUrl must be set if window.location is unavailable') | ||
}) | ||
}) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters