forked from codesandbox/codesandbox-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathurl.test.js
More file actions
41 lines (32 loc) · 1.13 KB
/
url.test.js
File metadata and controls
41 lines (32 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { getSandboxOptions } from './url.ts';
function testSandboxOptions(url: string) {
expect(getSandboxOptions(url)).toMatchSnapshot();
}
describe('url parameters', () => {
it('keeps everything false on normal urls', () => {
testSandboxOptions('https://codesandbox.io/s/new');
});
it('sets current module if there is one', () => {
testSandboxOptions('https://codesandbox.io/s/new?module=test');
});
it('sets preview view', () => {
testSandboxOptions('https://codesandbox.io/s/new?view=preview');
});
it('sets editor view', () => {
testSandboxOptions('https://codesandbox.io/s/new?view=editor');
});
it("doesn't set unknown fields", () => {
testSandboxOptions('https://codesandbox.io/s/new?view=both');
});
it('can hide navigation', () => {
testSandboxOptions('https://codesandbox.io/s/new?hidenavigation=1');
});
it('can autoresize', () => {
testSandboxOptions('https://codesandbox.io/s/new?autoresize=1');
});
it('can handle multiple options', () => {
testSandboxOptions(
'https://codesandbox.io/s/new?autoresize=1&view=editor&module=test&hidenavigation=1'
);
});
});