Skip to content

Commit 5d6f02b

Browse files
triniwizNathanWalker
authored andcommitted
chore: format tests
1 parent aaa96ed commit 5d6f02b

File tree

2 files changed

+85
-77
lines changed

2 files changed

+85
-77
lines changed

TestRunner/app/tests/URL.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
describe("Test URL ", function () {
2-
3-
it("Test invalid URL parsing", function(){
4-
var exceptionCaught = false;
5-
try {
6-
const url = new URL('');
2+
3+
it("Test invalid URL parsing", function(){
4+
var exceptionCaught = false;
5+
try {
6+
const url = new URL('');
77
}catch(e){
8-
exceptionCaught = true;
8+
exceptionCaught = true;
99
}
1010
expect(exceptionCaught).toBe(true);
11-
});
12-
13-
it("Test valid URL parsing", function(){
14-
var exceptionCaught = false;
15-
try {
16-
const url = new URL('https://google.com');
11+
});
12+
13+
it("Test valid URL parsing", function(){
14+
var exceptionCaught = false;
15+
try {
16+
const url = new URL('https://google.com');
1717
}catch(e){
18-
exceptionCaught = true;
18+
exceptionCaught = true;
1919
}
2020
expect(exceptionCaught).toBe(false);
21-
});
22-
23-
24-
it("Test URL fields", function(){
25-
var exceptionCaught = false;
26-
const url = new URL('https://google.com');
27-
expect(url.protocol).toBe('https:');
28-
expect(url.hostname).toBe('google.com');
29-
});
30-
21+
});
22+
23+
24+
it("Test URL fields", function(){
25+
var exceptionCaught = false;
26+
const url = new URL('https://google.com');
27+
expect(url.protocol).toBe('https:');
28+
expect(url.hostname).toBe('google.com');
29+
});
30+
3131
});
Lines changed: 62 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,64 @@
11
describe("Test URLSearchParams ", function () {
2-
3-
4-
it("Test URLSearchParams keys", function(){
5-
const params = new URLSearchParams("foo=1&bar=2");
6-
const keys = params.keys();
7-
expect(keys[0]).toBe("foo");
8-
expect(keys[1]).toBe("bar");
9-
});
10-
11-
it("Test URLSearchParams values", function(){
12-
const params = new URLSearchParams("foo=1&bar=2");
13-
const values = params.values();
14-
expect(values[0]).toBe("1");
15-
expect(values[1]).toBe("2");
16-
});
17-
18-
19-
it("Test URLSearchParams entries", function(){
20-
const params = new URLSearchParams("foo=1&bar=2");
21-
const entries = params.entries();
22-
expect(entries[0][0]).toBe("foo");
23-
expect(entries[0][1]).toBe("1");
24-
25-
expect(entries[1][0]).toBe("bar");
26-
expect(entries[1][1]).toBe("2");
27-
28-
});
29-
30-
31-
it("Test URLSearchParams size", function(){
32-
const params = new URLSearchParams("foo=1&bar=2");
33-
expect(params.size).toBe(2);
34-
});
35-
36-
it("Test URLSearchParams append", function(){
37-
const params = new URLSearchParams("foo=1&bar=2");
38-
params.append("first", "Osei");
39-
expect(params.get("first")).toBe("Osei");
40-
});
41-
42-
43-
it("Test URLSearchParams delete", function(){
44-
const params = new URLSearchParams("foo=1&bar=2");
45-
params.append("first", "Osei");
46-
params.delete("first");
47-
expect(params.get("first")).toBe(undefined);
48-
});
49-
50-
51-
it("Test URLSearchParams has", function(){
52-
const params = new URLSearchParams("foo=1&bar=2");
53-
expect(params.has("foo")).toBe(true);
54-
});
55-
2+
const fooBar = "foo=1&bar=2";
3+
it("Test URLSearchParams keys", function(){
4+
const params = new URLSearchParams(fooBar);
5+
const keys = params.keys();
6+
expect(keys[0]).toBe("foo");
7+
expect(keys[1]).toBe("bar");
8+
});
9+
10+
it("Test URLSearchParams values", function(){
11+
const params = new URLSearchParams(fooBar);
12+
const values = params.values();
13+
expect(values[0]).toBe("1");
14+
expect(values[1]).toBe("2");
15+
});
16+
17+
18+
it("Test URLSearchParams entries", function(){
19+
const params = new URLSearchParams(fooBar);
20+
const entries = params.entries();
21+
expect(entries[0][0]).toBe("foo");
22+
expect(entries[0][1]).toBe("1");
23+
24+
expect(entries[1][0]).toBe("bar");
25+
expect(entries[1][1]).toBe("2");
26+
27+
});
28+
29+
30+
it("Test URLSearchParams size", function(){
31+
const params = new URLSearchParams(fooBar);
32+
expect(params.size).toBe(2);
33+
});
34+
35+
it("Test URLSearchParams append", function(){
36+
const params = new URLSearchParams(fooBar);
37+
params.append("first", "Osei");
38+
expect(params.get("first")).toBe("Osei");
39+
});
40+
41+
42+
it("Test URLSearchParams delete", function(){
43+
const params = new URLSearchParams(fooBar);
44+
params.append("first", "Osei");
45+
params.delete("first");
46+
expect(params.get("first")).toBe(undefined);
47+
});
48+
49+
50+
it("Test URLSearchParams has", function(){
51+
const params = new URLSearchParams(fooBar);
52+
expect(params.has("foo")).toBe(true);
53+
});
54+
55+
it("Test URLSearchParams changes propagates to URL parent", function(){
56+
const toBe = 'https://github.com/triniwiz?first=Osei';
57+
const url = new URL('https://github.com/triniwiz');
58+
const params = url.searchParams;
59+
console.log(params);
60+
params.set('first', 'Osei');
61+
expect(url.toString()).toBe(toBe);
62+
});
63+
5664
});

0 commit comments

Comments
 (0)