Skip to content

Commit 059e1fb

Browse files
committed
test: enable URL query serializer tests
1 parent d75a00d commit 059e1fb

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

test/fixtures/url-tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4639,7 +4639,7 @@ module.exports =
46394639
"port": "",
46404640
"pathname": "/foo/bar",
46414641
"search": "??a=b&c=d",
4642-
// "searchParams": "%3Fa=b&c=d",
4642+
"searchParams": "%3Fa=b&c=d",
46434643
"hash": ""
46444644
},
46454645
"# Scheme only",

test/parallel/test-whatwg-url-constructor.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ function runURLSearchParamTests() {
120120
// And in the other direction, altering searchParams propagates
121121
// back to 'search'.
122122
searchParams.append('i', ' j ')
123-
// assert_equals(url.search, '?e=f&g=h&i=+j+')
124-
// assert_equals(url.searchParams.toString(), 'e=f&g=h&i=+j+')
123+
assert_equals(url.search, '?e=f&g=h&i=+j+')
124+
assert_equals(url.searchParams.toString(), 'e=f&g=h&i=+j+')
125125
assert_equals(searchParams.get('i'), ' j ')
126126

127127
searchParams.set('e', 'updated')
128-
// assert_equals(url.search, '?e=updated&g=h&i=+j+')
128+
assert_equals(url.search, '?e=updated&g=h&i=+j+')
129129
assert_equals(searchParams.get('e'), 'updated')
130130

131131
var url2 = bURL('http://example.org/file??a=b&c=d')

test/parallel/test-whatwg-url-searchparams-constructor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const {
1111
/* eslint-disable */
1212
var params; // Strict mode fix for WPT.
1313
/* WPT Refs:
14-
https://github.com/w3c/web-platform-tests/blob/405394a/url/urlsearchparams-constructor.html
14+
https://github.com/w3c/web-platform-tests/blob/e94c604916/url/urlsearchparams-constructor.html
1515
License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html
1616
*/
1717
test(function() {
@@ -154,7 +154,7 @@ test(function() {
154154
}, "Constructor with sequence of sequences of strings");
155155

156156
[
157-
// { "input": {"+": "%C2"}, "output": [[" ", "\uFFFD"]], "name": "object with +" },
157+
{ "input": {"+": "%C2"}, "output": [["+", "%C2"]], "name": "object with +" },
158158
{ "input": {c: "x", a: "?"}, "output": [["c", "x"], ["a", "?"]], "name": "object with two keys" },
159159
{ "input": [["c", "x"], ["a", "?"]], "output": [["c", "x"], ["a", "?"]], "name": "array with two keys" }
160160
].forEach((val) => {

test/parallel/test-whatwg-url-searchparams-stringifier.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ const { test, assert_equals } = common.WPT;
1010
https://github.com/w3c/web-platform-tests/blob/8791bed/url/urlsearchparams-stringifier.html
1111
License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html
1212
*/
13-
// test(function() {
14-
// var params = new URLSearchParams();
15-
// params.append('a', 'b c');
16-
// assert_equals(params + '', 'a=b+c');
17-
// params.delete('a');
18-
// params.append('a b', 'c');
19-
// assert_equals(params + '', 'a+b=c');
20-
// }, 'Serialize space');
13+
test(function() {
14+
var params = new URLSearchParams();
15+
params.append('a', 'b c');
16+
assert_equals(params + '', 'a=b+c');
17+
params.delete('a');
18+
params.append('a b', 'c');
19+
assert_equals(params + '', 'a+b=c');
20+
}, 'Serialize space');
2121

2222
test(function() {
2323
var params = new URLSearchParams();
@@ -114,8 +114,8 @@ test(function() {
114114
var params;
115115
params = new URLSearchParams('a=b&c=d&&e&&');
116116
assert_equals(params.toString(), 'a=b&c=d&e=');
117-
// params = new URLSearchParams('a = b &a=b&c=d%20');
118-
// assert_equals(params.toString(), 'a+=+b+&a=b&c=d+');
117+
params = new URLSearchParams('a = b &a=b&c=d%20');
118+
assert_equals(params.toString(), 'a+=+b+&a=b&c=d+');
119119
// The lone '=' _does_ survive the roundtrip.
120120
params = new URLSearchParams('a=&a=b');
121121
assert_equals(params.toString(), 'a=&a=b');

test/parallel/test-whatwg-url-searchparams.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const URL = require('url').URL;
77
// Tests below are not from WPT.
88
const serialized = 'a=a&a=1&a=true&a=undefined&a=null&a=%EF%BF%BD' +
99
'&a=%EF%BF%BD&a=%F0%9F%98%80&a=%EF%BF%BD%EF%BF%BD' +
10-
'&a=%5Bobject%20Object%5D';
10+
'&a=%5Bobject+Object%5D';
1111
const values = ['a', 1, true, undefined, null, '\uD83D', '\uDE00',
1212
'\uD83D\uDE00', '\uDE00\uD83D', {}];
1313
const normalizedValues = ['a', '1', 'true', 'undefined', 'null', '\uFFFD',

0 commit comments

Comments
 (0)