cdk-common 2.0.965 → 2.0.967
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +2 -2
- package/lib/main.js +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/assert.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/async_hooks.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/buffer.d.ts +16 -9
- package/node_modules/@types/concat-stream/node_modules/@types/node/child_process.d.ts +34 -29
- package/node_modules/@types/concat-stream/node_modules/@types/node/cluster.d.ts +2 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/console.d.ts +2 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/crypto.d.ts +3 -3
- package/node_modules/@types/concat-stream/node_modules/@types/node/diagnostics_channel.d.ts +4 -4
- package/node_modules/@types/concat-stream/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@types/concat-stream/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@types/concat-stream/node_modules/@types/node/domain.d.ts +2 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/fs/promises.d.ts +2 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/fs.d.ts +2 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/globals.d.ts +17 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/http.d.ts +7 -7
- package/node_modules/@types/concat-stream/node_modules/@types/node/http2.d.ts +238 -101
- package/node_modules/@types/concat-stream/node_modules/@types/node/https.d.ts +17 -23
- package/node_modules/@types/concat-stream/node_modules/@types/node/inspector.d.ts +67 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/module.d.ts +3 -3
- package/node_modules/@types/concat-stream/node_modules/@types/node/net.d.ts +11 -15
- package/node_modules/@types/concat-stream/node_modules/@types/node/os.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/path.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/perf_hooks.d.ts +19 -19
- package/node_modules/@types/concat-stream/node_modules/@types/node/punycode.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/querystring.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/readline/promises.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/readline.d.ts +9 -9
- package/node_modules/@types/concat-stream/node_modules/@types/node/repl.d.ts +4 -4
- package/node_modules/@types/concat-stream/node_modules/@types/node/sqlite.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/stream/web.d.ts +17 -17
- package/node_modules/@types/concat-stream/node_modules/@types/node/stream.d.ts +15 -15
- package/node_modules/@types/concat-stream/node_modules/@types/node/string_decoder.d.ts +3 -3
- package/node_modules/@types/concat-stream/node_modules/@types/node/test.d.ts +2 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/timers/promises.d.ts +5 -5
- package/node_modules/@types/concat-stream/node_modules/@types/node/timers.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/tls.d.ts +5 -5
- package/node_modules/@types/concat-stream/node_modules/@types/node/trace_events.d.ts +4 -4
- package/node_modules/@types/concat-stream/node_modules/@types/node/tty.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/url.d.ts +7 -7
- package/node_modules/@types/concat-stream/node_modules/@types/node/util.d.ts +44 -44
- package/node_modules/@types/concat-stream/node_modules/@types/node/v8.d.ts +12 -12
- package/node_modules/@types/concat-stream/node_modules/@types/node/vm.d.ts +13 -13
- package/node_modules/@types/concat-stream/node_modules/@types/node/wasi.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/worker_threads.d.ts +22 -22
- package/node_modules/@types/concat-stream/node_modules/@types/node/zlib.d.ts +8 -8
- package/node_modules/@types/form-data/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/assert.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/async_hooks.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/buffer.d.ts +16 -9
- package/node_modules/@types/form-data/node_modules/@types/node/child_process.d.ts +34 -29
- package/node_modules/@types/form-data/node_modules/@types/node/cluster.d.ts +2 -1
- package/node_modules/@types/form-data/node_modules/@types/node/console.d.ts +2 -2
- package/node_modules/@types/form-data/node_modules/@types/node/crypto.d.ts +3 -3
- package/node_modules/@types/form-data/node_modules/@types/node/diagnostics_channel.d.ts +4 -4
- package/node_modules/@types/form-data/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@types/form-data/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@types/form-data/node_modules/@types/node/domain.d.ts +2 -2
- package/node_modules/@types/form-data/node_modules/@types/node/fs/promises.d.ts +2 -2
- package/node_modules/@types/form-data/node_modules/@types/node/fs.d.ts +2 -2
- package/node_modules/@types/form-data/node_modules/@types/node/globals.d.ts +17 -1
- package/node_modules/@types/form-data/node_modules/@types/node/http.d.ts +7 -7
- package/node_modules/@types/form-data/node_modules/@types/node/http2.d.ts +238 -101
- package/node_modules/@types/form-data/node_modules/@types/node/https.d.ts +17 -23
- package/node_modules/@types/form-data/node_modules/@types/node/inspector.d.ts +67 -0
- package/node_modules/@types/form-data/node_modules/@types/node/module.d.ts +3 -3
- package/node_modules/@types/form-data/node_modules/@types/node/net.d.ts +11 -15
- package/node_modules/@types/form-data/node_modules/@types/node/os.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/form-data/node_modules/@types/node/path.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/perf_hooks.d.ts +19 -19
- package/node_modules/@types/form-data/node_modules/@types/node/punycode.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/querystring.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/readline/promises.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/readline.d.ts +9 -9
- package/node_modules/@types/form-data/node_modules/@types/node/repl.d.ts +4 -4
- package/node_modules/@types/form-data/node_modules/@types/node/sqlite.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/stream/web.d.ts +17 -17
- package/node_modules/@types/form-data/node_modules/@types/node/stream.d.ts +15 -15
- package/node_modules/@types/form-data/node_modules/@types/node/string_decoder.d.ts +3 -3
- package/node_modules/@types/form-data/node_modules/@types/node/test.d.ts +2 -2
- package/node_modules/@types/form-data/node_modules/@types/node/timers/promises.d.ts +5 -5
- package/node_modules/@types/form-data/node_modules/@types/node/timers.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/tls.d.ts +5 -5
- package/node_modules/@types/form-data/node_modules/@types/node/trace_events.d.ts +4 -4
- package/node_modules/@types/form-data/node_modules/@types/node/tty.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/url.d.ts +7 -7
- package/node_modules/@types/form-data/node_modules/@types/node/util.d.ts +44 -44
- package/node_modules/@types/form-data/node_modules/@types/node/v8.d.ts +12 -12
- package/node_modules/@types/form-data/node_modules/@types/node/vm.d.ts +13 -13
- package/node_modules/@types/form-data/node_modules/@types/node/wasi.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/worker_threads.d.ts +22 -22
- package/node_modules/@types/form-data/node_modules/@types/node/zlib.d.ts +8 -8
- package/node_modules/fast-uri/.github/workflows/ci.yml +2 -2
- package/node_modules/fast-uri/.github/workflows/package-manager-ci.yml +1 -1
- package/node_modules/fast-uri/index.js +3 -9
- package/node_modules/fast-uri/package.json +3 -3
- package/node_modules/fast-uri/test/ajv.test.js +1 -1
- package/node_modules/fast-uri/test/compatibility.test.js +3 -2
- package/node_modules/fast-uri/test/equal.test.js +1 -2
- package/node_modules/fast-uri/test/parse.test.js +1 -2
- package/node_modules/fast-uri/test/resolve.test.js +1 -2
- package/node_modules/fast-uri/test/serialize.test.js +1 -2
- package/node_modules/fast-uri/test/uri-js.test.js +539 -567
- package/node_modules/fast-uri/test/util.test.js +2 -3
- package/package.json +1 -1
- package/node_modules/fast-uri/.taprc +0 -3
|
@@ -1,27 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
ok,
|
|
5
|
-
same: deepEqual,
|
|
6
|
-
strictSame: strictEqual,
|
|
7
|
-
notSame: notStrictEqual,
|
|
8
|
-
test: tapTest
|
|
9
|
-
} = require('tap')
|
|
10
|
-
|
|
11
|
-
const test = function () {
|
|
12
|
-
if (typeof arguments[2] === 'function') {
|
|
13
|
-
tapTest(arguments[0], arguments[1], t => {
|
|
14
|
-
arguments[2](t)
|
|
15
|
-
t.end()
|
|
16
|
-
})
|
|
17
|
-
} else {
|
|
18
|
-
tapTest(arguments[0], t => {
|
|
19
|
-
arguments[1](t)
|
|
20
|
-
t.end()
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
3
|
+
const test = require('tape')
|
|
25
4
|
const URI = require('../index')
|
|
26
5
|
|
|
27
6
|
/**
|
|
@@ -60,260 +39,249 @@ const URI = require('../index')
|
|
|
60
39
|
* or implied, of Gary Court.
|
|
61
40
|
*/
|
|
62
41
|
|
|
63
|
-
test('Acquire URI',
|
|
64
|
-
|
|
65
|
-
|
|
42
|
+
test('Acquire URI', (t) => {
|
|
43
|
+
t.ok(URI)
|
|
44
|
+
t.end()
|
|
66
45
|
})
|
|
67
46
|
|
|
68
|
-
test('URI Parsing',
|
|
47
|
+
test('URI Parsing', (t) => {
|
|
69
48
|
let components
|
|
70
49
|
|
|
71
50
|
// scheme
|
|
72
51
|
components = URI.parse('uri:')
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
strictEqual(components.fragment, undefined, 'fragment')
|
|
52
|
+
t.equal(components.error, undefined, 'scheme errors')
|
|
53
|
+
t.equal(components.scheme, 'uri', 'scheme')
|
|
54
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
55
|
+
t.equal(components.host, undefined, 'host')
|
|
56
|
+
t.equal(components.port, undefined, 'port')
|
|
57
|
+
t.equal(components.path, '', 'path')
|
|
58
|
+
t.equal(components.query, undefined, 'query')
|
|
59
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
82
60
|
|
|
83
61
|
// userinfo
|
|
84
62
|
components = URI.parse('//@')
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
strictEqual(components.fragment, undefined, 'fragment')
|
|
63
|
+
t.equal(components.error, undefined, 'userinfo errors')
|
|
64
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
65
|
+
t.equal(components.userinfo, '', 'userinfo')
|
|
66
|
+
t.equal(components.host, '', 'host')
|
|
67
|
+
t.equal(components.port, undefined, 'port')
|
|
68
|
+
t.equal(components.path, '', 'path')
|
|
69
|
+
t.equal(components.query, undefined, 'query')
|
|
70
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
94
71
|
|
|
95
72
|
// host
|
|
96
73
|
components = URI.parse('//')
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
strictEqual(components.fragment, undefined, 'fragment')
|
|
74
|
+
t.equal(components.error, undefined, 'host errors')
|
|
75
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
76
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
77
|
+
t.equal(components.host, '', 'host')
|
|
78
|
+
t.equal(components.port, undefined, 'port')
|
|
79
|
+
t.equal(components.path, '', 'path')
|
|
80
|
+
t.equal(components.query, undefined, 'query')
|
|
81
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
106
82
|
|
|
107
83
|
// port
|
|
108
84
|
components = URI.parse('//:')
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
strictEqual(components.fragment, undefined, 'fragment')
|
|
85
|
+
t.equal(components.error, undefined, 'port errors')
|
|
86
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
87
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
88
|
+
t.equal(components.host, '', 'host')
|
|
89
|
+
t.equal(components.port, '', 'port')
|
|
90
|
+
t.equal(components.path, '', 'path')
|
|
91
|
+
t.equal(components.query, undefined, 'query')
|
|
92
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
118
93
|
|
|
119
94
|
// path
|
|
120
95
|
components = URI.parse('')
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
strictEqual(components.fragment, undefined, 'fragment')
|
|
96
|
+
t.equal(components.error, undefined, 'path errors')
|
|
97
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
98
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
99
|
+
t.equal(components.host, undefined, 'host')
|
|
100
|
+
t.equal(components.port, undefined, 'port')
|
|
101
|
+
t.equal(components.path, '', 'path')
|
|
102
|
+
t.equal(components.query, undefined, 'query')
|
|
103
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
130
104
|
|
|
131
105
|
// query
|
|
132
106
|
components = URI.parse('?')
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
strictEqual(components.fragment, undefined, 'fragment')
|
|
107
|
+
t.equal(components.error, undefined, 'query errors')
|
|
108
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
109
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
110
|
+
t.equal(components.host, undefined, 'host')
|
|
111
|
+
t.equal(components.port, undefined, 'port')
|
|
112
|
+
t.equal(components.path, '', 'path')
|
|
113
|
+
t.equal(components.query, '', 'query')
|
|
114
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
142
115
|
|
|
143
116
|
// fragment
|
|
144
117
|
components = URI.parse('#')
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
strictEqual(components.fragment, '', 'fragment')
|
|
118
|
+
t.equal(components.error, undefined, 'fragment errors')
|
|
119
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
120
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
121
|
+
t.equal(components.host, undefined, 'host')
|
|
122
|
+
t.equal(components.port, undefined, 'port')
|
|
123
|
+
t.equal(components.path, '', 'path')
|
|
124
|
+
t.equal(components.query, undefined, 'query')
|
|
125
|
+
t.equal(components.fragment, '', 'fragment')
|
|
154
126
|
|
|
155
127
|
// fragment with character tabulation
|
|
156
128
|
components = URI.parse('#\t')
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
strictEqual(components.fragment, '%09', 'fragment')
|
|
129
|
+
t.equal(components.error, undefined, 'path errors')
|
|
130
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
131
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
132
|
+
t.equal(components.host, undefined, 'host')
|
|
133
|
+
t.equal(components.port, undefined, 'port')
|
|
134
|
+
t.equal(components.path, '', 'path')
|
|
135
|
+
t.equal(components.query, undefined, 'query')
|
|
136
|
+
t.equal(components.fragment, '%09', 'fragment')
|
|
166
137
|
|
|
167
138
|
// fragment with line feed
|
|
168
139
|
components = URI.parse('#\n')
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
strictEqual(components.fragment, '%0A', 'fragment')
|
|
140
|
+
t.equal(components.error, undefined, 'path errors')
|
|
141
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
142
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
143
|
+
t.equal(components.host, undefined, 'host')
|
|
144
|
+
t.equal(components.port, undefined, 'port')
|
|
145
|
+
t.equal(components.path, '', 'path')
|
|
146
|
+
t.equal(components.query, undefined, 'query')
|
|
147
|
+
t.equal(components.fragment, '%0A', 'fragment')
|
|
178
148
|
|
|
179
149
|
// fragment with line tabulation
|
|
180
150
|
components = URI.parse('#\v')
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
strictEqual(components.fragment, '%0B', 'fragment')
|
|
151
|
+
t.equal(components.error, undefined, 'path errors')
|
|
152
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
153
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
154
|
+
t.equal(components.host, undefined, 'host')
|
|
155
|
+
t.equal(components.port, undefined, 'port')
|
|
156
|
+
t.equal(components.path, '', 'path')
|
|
157
|
+
t.equal(components.query, undefined, 'query')
|
|
158
|
+
t.equal(components.fragment, '%0B', 'fragment')
|
|
190
159
|
|
|
191
160
|
// fragment with form feed
|
|
192
161
|
components = URI.parse('#\f')
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
strictEqual(components.fragment, '%0C', 'fragment')
|
|
162
|
+
t.equal(components.error, undefined, 'path errors')
|
|
163
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
164
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
165
|
+
t.equal(components.host, undefined, 'host')
|
|
166
|
+
t.equal(components.port, undefined, 'port')
|
|
167
|
+
t.equal(components.path, '', 'path')
|
|
168
|
+
t.equal(components.query, undefined, 'query')
|
|
169
|
+
t.equal(components.fragment, '%0C', 'fragment')
|
|
202
170
|
|
|
203
171
|
// fragment with carriage return
|
|
204
172
|
components = URI.parse('#\r')
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
strictEqual(components.fragment, '%0D', 'fragment')
|
|
173
|
+
t.equal(components.error, undefined, 'path errors')
|
|
174
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
175
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
176
|
+
t.equal(components.host, undefined, 'host')
|
|
177
|
+
t.equal(components.port, undefined, 'port')
|
|
178
|
+
t.equal(components.path, '', 'path')
|
|
179
|
+
t.equal(components.query, undefined, 'query')
|
|
180
|
+
t.equal(components.fragment, '%0D', 'fragment')
|
|
214
181
|
|
|
215
182
|
// all
|
|
216
183
|
components = URI.parse('uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body')
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
strictEqual(components.fragment, 'body', 'fragment')
|
|
184
|
+
t.equal(components.error, undefined, 'all errors')
|
|
185
|
+
t.equal(components.scheme, 'uri', 'scheme')
|
|
186
|
+
t.equal(components.userinfo, 'user:pass', 'userinfo')
|
|
187
|
+
t.equal(components.host, 'example.com', 'host')
|
|
188
|
+
t.equal(components.port, 123, 'port')
|
|
189
|
+
t.equal(components.path, '/one/two.three', 'path')
|
|
190
|
+
t.equal(components.query, 'q1=a1&q2=a2', 'query')
|
|
191
|
+
t.equal(components.fragment, 'body', 'fragment')
|
|
226
192
|
|
|
227
193
|
// IPv4address
|
|
228
194
|
components = URI.parse('//10.10.10.10')
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
195
|
+
t.equal(components.error, undefined, 'IPv4address errors')
|
|
196
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
197
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
198
|
+
t.equal(components.host, '10.10.10.10', 'host')
|
|
199
|
+
t.equal(components.port, undefined, 'port')
|
|
200
|
+
t.equal(components.path, '', 'path')
|
|
201
|
+
t.equal(components.query, undefined, 'query')
|
|
202
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
237
203
|
|
|
238
204
|
// IPv6address
|
|
239
205
|
components = URI.parse('//[2001:db8::7]')
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
206
|
+
t.equal(components.error, undefined, 'IPv4address errors')
|
|
207
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
208
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
209
|
+
t.equal(components.host, '2001:db8::7', 'host')
|
|
210
|
+
t.equal(components.port, undefined, 'port')
|
|
211
|
+
t.equal(components.path, '', 'path')
|
|
212
|
+
t.equal(components.query, undefined, 'query')
|
|
213
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
248
214
|
|
|
249
215
|
// mixed IPv4address & IPv6address
|
|
250
216
|
components = URI.parse('//[::ffff:129.144.52.38]')
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
217
|
+
t.equal(components.error, undefined, 'IPv4address errors')
|
|
218
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
219
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
220
|
+
t.equal(components.host, '::ffff:129.144.52.38', 'host')
|
|
221
|
+
t.equal(components.port, undefined, 'port')
|
|
222
|
+
t.equal(components.path, '', 'path')
|
|
223
|
+
t.equal(components.query, undefined, 'query')
|
|
224
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
259
225
|
|
|
260
226
|
// mixed IPv4address & reg-name, example from terion-name (https://github.com/garycourt/uri-js/issues/4)
|
|
261
227
|
components = URI.parse('uri://10.10.10.10.example.com/en/process')
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
228
|
+
t.equal(components.error, undefined, 'mixed errors')
|
|
229
|
+
t.equal(components.scheme, 'uri', 'scheme')
|
|
230
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
231
|
+
t.equal(components.host, '10.10.10.10.example.com', 'host')
|
|
232
|
+
t.equal(components.port, undefined, 'port')
|
|
233
|
+
t.equal(components.path, '/en/process', 'path')
|
|
234
|
+
t.equal(components.query, undefined, 'query')
|
|
235
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
270
236
|
|
|
271
237
|
// IPv6address, example from bkw (https://github.com/garycourt/uri-js/pull/16)
|
|
272
238
|
components = URI.parse('//[2606:2800:220:1:248:1893:25c8:1946]/test')
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
239
|
+
t.equal(components.error, undefined, 'IPv6address errors')
|
|
240
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
241
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
242
|
+
t.equal(components.host, '2606:2800:220:1:248:1893:25c8:1946', 'host')
|
|
243
|
+
t.equal(components.port, undefined, 'port')
|
|
244
|
+
t.equal(components.path, '/test', 'path')
|
|
245
|
+
t.equal(components.query, undefined, 'query')
|
|
246
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
281
247
|
|
|
282
248
|
// IPv6address, example from RFC 5952
|
|
283
249
|
components = URI.parse('//[2001:db8::1]:80')
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
250
|
+
t.equal(components.error, undefined, 'IPv6address errors')
|
|
251
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
252
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
253
|
+
t.equal(components.host, '2001:db8::1', 'host')
|
|
254
|
+
t.equal(components.port, 80, 'port')
|
|
255
|
+
t.equal(components.path, '', 'path')
|
|
256
|
+
t.equal(components.query, undefined, 'query')
|
|
257
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
292
258
|
|
|
293
259
|
// IPv6address with zone identifier, RFC 6874
|
|
294
260
|
components = URI.parse('//[fe80::a%25en1]')
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
261
|
+
t.equal(components.error, undefined, 'IPv4address errors')
|
|
262
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
263
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
264
|
+
t.equal(components.host, 'fe80::a%en1', 'host')
|
|
265
|
+
t.equal(components.port, undefined, 'port')
|
|
266
|
+
t.equal(components.path, '', 'path')
|
|
267
|
+
t.equal(components.query, undefined, 'query')
|
|
268
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
303
269
|
|
|
304
270
|
// IPv6address with an unescaped interface specifier, example from pekkanikander (https://github.com/garycourt/uri-js/pull/22)
|
|
305
271
|
components = URI.parse('//[2001:db8::7%en0]')
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
272
|
+
t.equal(components.error, undefined, 'IPv6address interface errors')
|
|
273
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
274
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
275
|
+
t.equal(components.host, '2001:db8::7%en0', 'host')
|
|
276
|
+
t.equal(components.port, undefined, 'port')
|
|
277
|
+
t.equal(components.path, '', 'path')
|
|
278
|
+
t.equal(components.query, undefined, 'query')
|
|
279
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
280
|
+
|
|
281
|
+
t.end()
|
|
314
282
|
})
|
|
315
283
|
|
|
316
|
-
test('URI Serialization',
|
|
284
|
+
test('URI Serialization', (t) => {
|
|
317
285
|
let components = {
|
|
318
286
|
scheme: undefined,
|
|
319
287
|
userinfo: undefined,
|
|
@@ -323,7 +291,7 @@ test('URI Serialization', function () {
|
|
|
323
291
|
query: undefined,
|
|
324
292
|
fragment: undefined
|
|
325
293
|
}
|
|
326
|
-
|
|
294
|
+
t.equal(URI.serialize(components), '', 'Undefined Components')
|
|
327
295
|
|
|
328
296
|
components = {
|
|
329
297
|
scheme: '',
|
|
@@ -334,7 +302,7 @@ test('URI Serialization', function () {
|
|
|
334
302
|
query: '',
|
|
335
303
|
fragment: ''
|
|
336
304
|
}
|
|
337
|
-
|
|
305
|
+
t.equal(URI.serialize(components), '//@:0?#', 'Empty Components')
|
|
338
306
|
|
|
339
307
|
components = {
|
|
340
308
|
scheme: 'uri',
|
|
@@ -345,172 +313,177 @@ test('URI Serialization', function () {
|
|
|
345
313
|
query: 'query',
|
|
346
314
|
fragment: 'fragment'
|
|
347
315
|
}
|
|
348
|
-
|
|
316
|
+
t.equal(URI.serialize(components), 'uri://foo:bar@example.com:1/path?query#fragment', 'All Components')
|
|
349
317
|
|
|
350
318
|
components = {
|
|
351
319
|
scheme: 'uri',
|
|
352
320
|
host: 'example.com',
|
|
353
321
|
port: '9000'
|
|
354
322
|
}
|
|
355
|
-
|
|
323
|
+
t.equal(URI.serialize(components), 'uri://example.com:9000', 'String port')
|
|
356
324
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
325
|
+
t.equal(URI.serialize({ path: '//path' }), '/%2Fpath', 'Double slash path')
|
|
326
|
+
t.equal(URI.serialize({ path: 'foo:bar' }), 'foo%3Abar', 'Colon path')
|
|
327
|
+
t.equal(URI.serialize({ path: '?query' }), '%3Fquery', 'Query path')
|
|
360
328
|
|
|
361
329
|
// mixed IPv4address & reg-name, example from terion-name (https://github.com/garycourt/uri-js/issues/4)
|
|
362
|
-
|
|
330
|
+
t.equal(URI.serialize({ host: '10.10.10.10.example.com' }), '//10.10.10.10.example.com', 'Mixed IPv4address & reg-name')
|
|
363
331
|
|
|
364
332
|
// IPv6address
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
333
|
+
t.equal(URI.serialize({ host: '2001:db8::7' }), '//[2001:db8::7]', 'IPv6 Host')
|
|
334
|
+
t.equal(URI.serialize({ host: '::ffff:129.144.52.38' }), '//[::ffff:129.144.52.38]', 'IPv6 Mixed Host')
|
|
335
|
+
t.equal(URI.serialize({ host: '2606:2800:220:1:248:1893:25c8:1946' }), '//[2606:2800:220:1:248:1893:25c8:1946]', 'IPv6 Full Host')
|
|
368
336
|
|
|
369
337
|
// IPv6address with zone identifier, RFC 6874
|
|
370
|
-
|
|
371
|
-
|
|
338
|
+
t.equal(URI.serialize({ host: 'fe80::a%en1' }), '//[fe80::a%25en1]', 'IPv6 Zone Unescaped Host')
|
|
339
|
+
t.equal(URI.serialize({ host: 'fe80::a%25en1' }), '//[fe80::a%25en1]', 'IPv6 Zone Escaped Host')
|
|
340
|
+
|
|
341
|
+
t.end()
|
|
372
342
|
})
|
|
373
343
|
|
|
374
|
-
test('URI Resolving', { skip: true },
|
|
344
|
+
test('URI Resolving', { skip: true }, (t) => {
|
|
375
345
|
// normal examples from RFC 3986
|
|
376
346
|
const base = 'uri://a/b/c/d;p?q'
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
strictEqual(URI.resolve(base, '../../g'), 'uri://a/g', '../../g')
|
|
347
|
+
t.equal(URI.resolve(base, 'g:h'), 'g:h', 'g:h')
|
|
348
|
+
t.equal(URI.resolve(base, 'g'), 'uri://a/b/c/g', 'g')
|
|
349
|
+
t.equal(URI.resolve(base, './g'), 'uri://a/b/c/g', './g')
|
|
350
|
+
t.equal(URI.resolve(base, 'g/'), 'uri://a/b/c/g/', 'g/')
|
|
351
|
+
t.equal(URI.resolve(base, '/g'), 'uri://a/g', '/g')
|
|
352
|
+
t.equal(URI.resolve(base, '//g'), 'uri://g', '//g')
|
|
353
|
+
t.equal(URI.resolve(base, '?y'), 'uri://a/b/c/d;p?y', '?y')
|
|
354
|
+
t.equal(URI.resolve(base, 'g?y'), 'uri://a/b/c/g?y', 'g?y')
|
|
355
|
+
t.equal(URI.resolve(base, '#s'), 'uri://a/b/c/d;p?q#s', '#s')
|
|
356
|
+
t.equal(URI.resolve(base, 'g#s'), 'uri://a/b/c/g#s', 'g#s')
|
|
357
|
+
t.equal(URI.resolve(base, 'g?y#s'), 'uri://a/b/c/g?y#s', 'g?y#s')
|
|
358
|
+
t.equal(URI.resolve(base, ';x'), 'uri://a/b/c/;x', ';x')
|
|
359
|
+
t.equal(URI.resolve(base, 'g;x'), 'uri://a/b/c/g;x', 'g;x')
|
|
360
|
+
t.equal(URI.resolve(base, 'g;x?y#s'), 'uri://a/b/c/g;x?y#s', 'g;x?y#s')
|
|
361
|
+
t.equal(URI.resolve(base, ''), 'uri://a/b/c/d;p?q', '')
|
|
362
|
+
t.equal(URI.resolve(base, '.'), 'uri://a/b/c/', '.')
|
|
363
|
+
t.equal(URI.resolve(base, './'), 'uri://a/b/c/', './')
|
|
364
|
+
t.equal(URI.resolve(base, '..'), 'uri://a/b/', '..')
|
|
365
|
+
t.equal(URI.resolve(base, '../'), 'uri://a/b/', '../')
|
|
366
|
+
t.equal(URI.resolve(base, '../g'), 'uri://a/b/g', '../g')
|
|
367
|
+
t.equal(URI.resolve(base, '../..'), 'uri://a/', '../..')
|
|
368
|
+
t.equal(URI.resolve(base, '../../'), 'uri://a/', '../../')
|
|
369
|
+
t.equal(URI.resolve(base, '../../g'), 'uri://a/g', '../../g')
|
|
401
370
|
|
|
402
371
|
// abnormal examples from RFC 3986
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
372
|
+
t.equal(URI.resolve(base, '../../../g'), 'uri://a/g', '../../../g')
|
|
373
|
+
t.equal(URI.resolve(base, '../../../../g'), 'uri://a/g', '../../../../g')
|
|
374
|
+
|
|
375
|
+
t.equal(URI.resolve(base, '/./g'), 'uri://a/g', '/./g')
|
|
376
|
+
t.equal(URI.resolve(base, '/../g'), 'uri://a/g', '/../g')
|
|
377
|
+
t.equal(URI.resolve(base, 'g.'), 'uri://a/b/c/g.', 'g.')
|
|
378
|
+
t.equal(URI.resolve(base, '.g'), 'uri://a/b/c/.g', '.g')
|
|
379
|
+
t.equal(URI.resolve(base, 'g..'), 'uri://a/b/c/g..', 'g..')
|
|
380
|
+
t.equal(URI.resolve(base, '..g'), 'uri://a/b/c/..g', '..g')
|
|
381
|
+
|
|
382
|
+
t.equal(URI.resolve(base, './../g'), 'uri://a/b/g', './../g')
|
|
383
|
+
t.equal(URI.resolve(base, './g/.'), 'uri://a/b/c/g/', './g/.')
|
|
384
|
+
t.equal(URI.resolve(base, 'g/./h'), 'uri://a/b/c/g/h', 'g/./h')
|
|
385
|
+
t.equal(URI.resolve(base, 'g/../h'), 'uri://a/b/c/h', 'g/../h')
|
|
386
|
+
t.equal(URI.resolve(base, 'g;x=1/./y'), 'uri://a/b/c/g;x=1/y', 'g;x=1/./y')
|
|
387
|
+
t.equal(URI.resolve(base, 'g;x=1/../y'), 'uri://a/b/c/y', 'g;x=1/../y')
|
|
388
|
+
|
|
389
|
+
t.equal(URI.resolve(base, 'g?y/./x'), 'uri://a/b/c/g?y/./x', 'g?y/./x')
|
|
390
|
+
t.equal(URI.resolve(base, 'g?y/../x'), 'uri://a/b/c/g?y/../x', 'g?y/../x')
|
|
391
|
+
t.equal(URI.resolve(base, 'g#s/./x'), 'uri://a/b/c/g#s/./x', 'g#s/./x')
|
|
392
|
+
t.equal(URI.resolve(base, 'g#s/../x'), 'uri://a/b/c/g#s/../x', 'g#s/../x')
|
|
393
|
+
|
|
394
|
+
t.equal(URI.resolve(base, 'uri:g'), 'uri:g', 'uri:g')
|
|
395
|
+
t.equal(URI.resolve(base, 'uri:g', { tolerant: true }), 'uri://a/b/c/g', 'uri:g')
|
|
427
396
|
|
|
428
397
|
// examples by PAEz
|
|
429
|
-
|
|
430
|
-
|
|
398
|
+
t.equal(URI.resolve('//www.g.com/', '/adf\ngf'), '//www.g.com/adf%0Agf', '/adf\\ngf')
|
|
399
|
+
t.equal(URI.resolve('//www.g.com/error\n/bleh/bleh', '..'), '//www.g.com/error%0A/', '//www.g.com/error\\n/bleh/bleh')
|
|
400
|
+
|
|
401
|
+
t.end()
|
|
431
402
|
})
|
|
432
403
|
|
|
433
|
-
test('URI Normalizing', { skip: true },
|
|
404
|
+
test('URI Normalizing', { skip: true }, (t) => {
|
|
434
405
|
// test from RFC 3987
|
|
435
|
-
|
|
406
|
+
t.equal(URI.normalize('uri://www.example.org/red%09ros\xE9#red'), 'uri://www.example.org/red%09ros%C3%A9#red')
|
|
436
407
|
|
|
437
408
|
// IPv4address
|
|
438
|
-
|
|
409
|
+
t.equal(URI.normalize('//192.068.001.000'), '//192.68.1.0')
|
|
439
410
|
|
|
440
411
|
// IPv6address, example from RFC 3513
|
|
441
|
-
|
|
412
|
+
t.equal(URI.normalize('http://[1080::8:800:200C:417A]/'), 'http://[1080::8:800:200c:417a]/')
|
|
442
413
|
|
|
443
414
|
// IPv6address, examples from RFC 5952
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
415
|
+
t.equal(URI.normalize('//[2001:0db8::0001]/'), '//[2001:db8::1]/')
|
|
416
|
+
t.equal(URI.normalize('//[2001:db8::1:0000:1]/'), '//[2001:db8::1:0:1]/')
|
|
417
|
+
t.equal(URI.normalize('//[2001:db8:0:0:0:0:2:1]/'), '//[2001:db8::2:1]/')
|
|
418
|
+
t.equal(URI.normalize('//[2001:db8:0:1:1:1:1:1]/'), '//[2001:db8:0:1:1:1:1:1]/')
|
|
419
|
+
t.equal(URI.normalize('//[2001:0:0:1:0:0:0:1]/'), '//[2001:0:0:1::1]/')
|
|
420
|
+
t.equal(URI.normalize('//[2001:db8:0:0:1:0:0:1]/'), '//[2001:db8::1:0:0:1]/')
|
|
421
|
+
t.equal(URI.normalize('//[2001:DB8::1]/'), '//[2001:db8::1]/')
|
|
422
|
+
t.equal(URI.normalize('//[0:0:0:0:0:ffff:192.0.2.1]/'), '//[::ffff:192.0.2.1]/')
|
|
452
423
|
|
|
453
424
|
// Mixed IPv4 and IPv6 address
|
|
454
|
-
|
|
455
|
-
|
|
425
|
+
t.equal(URI.normalize('//[1:2:3:4:5:6:192.0.2.1]/'), '//[1:2:3:4:5:6:192.0.2.1]/')
|
|
426
|
+
t.equal(URI.normalize('//[1:2:3:4:5:6:192.068.001.000]/'), '//[1:2:3:4:5:6:192.68.1.0]/')
|
|
427
|
+
|
|
428
|
+
t.end()
|
|
456
429
|
})
|
|
457
430
|
|
|
458
|
-
test('URI Equals',
|
|
431
|
+
test('URI Equals', (t) => {
|
|
459
432
|
// test from RFC 3986
|
|
460
|
-
|
|
433
|
+
t.equal(URI.equal('example://a/b/c/%7Bfoo%7D', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d'), true)
|
|
461
434
|
|
|
462
435
|
// test from RFC 3987
|
|
463
|
-
|
|
436
|
+
t.equal(URI.equal('http://example.org/~user', 'http://example.org/%7euser'), true)
|
|
437
|
+
|
|
438
|
+
t.end()
|
|
464
439
|
})
|
|
465
440
|
|
|
466
|
-
test('Escape Component', { skip: true },
|
|
441
|
+
test('Escape Component', { skip: true }, (t) => {
|
|
467
442
|
let chr
|
|
468
443
|
for (let d = 0; d <= 129; ++d) {
|
|
469
444
|
chr = String.fromCharCode(d)
|
|
470
445
|
if (!chr.match(/[$&+,;=]/)) {
|
|
471
|
-
|
|
446
|
+
t.equal(URI.escapeComponent(chr), encodeURIComponent(chr))
|
|
472
447
|
} else {
|
|
473
|
-
|
|
448
|
+
t.equal(URI.escapeComponent(chr), chr)
|
|
474
449
|
}
|
|
475
450
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
451
|
+
t.equal(URI.escapeComponent('\u00c0'), encodeURIComponent('\u00c0'))
|
|
452
|
+
t.equal(URI.escapeComponent('\u07ff'), encodeURIComponent('\u07ff'))
|
|
453
|
+
t.equal(URI.escapeComponent('\u0800'), encodeURIComponent('\u0800'))
|
|
454
|
+
t.equal(URI.escapeComponent('\u30a2'), encodeURIComponent('\u30a2'))
|
|
455
|
+
t.end()
|
|
480
456
|
})
|
|
481
457
|
|
|
482
|
-
test('Unescape Component', { skip: true },
|
|
458
|
+
test('Unescape Component', { skip: true }, (t) => {
|
|
483
459
|
let chr
|
|
484
460
|
for (let d = 0; d <= 129; ++d) {
|
|
485
461
|
chr = String.fromCharCode(d)
|
|
486
|
-
|
|
462
|
+
t.equal(URI.unescapeComponent(encodeURIComponent(chr)), chr)
|
|
487
463
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
464
|
+
t.equal(URI.unescapeComponent(encodeURIComponent('\u00c0')), '\u00c0')
|
|
465
|
+
t.equal(URI.unescapeComponent(encodeURIComponent('\u07ff')), '\u07ff')
|
|
466
|
+
t.equal(URI.unescapeComponent(encodeURIComponent('\u0800')), '\u0800')
|
|
467
|
+
t.equal(URI.unescapeComponent(encodeURIComponent('\u30a2')), '\u30a2')
|
|
468
|
+
t.end()
|
|
492
469
|
})
|
|
493
470
|
|
|
494
|
-
//
|
|
495
|
-
// IRI
|
|
496
|
-
//
|
|
497
|
-
|
|
498
471
|
const IRI_OPTION = { iri: true, unicodeSupport: true }
|
|
499
472
|
|
|
500
|
-
test('IRI Parsing', { skip: true },
|
|
473
|
+
test('IRI Parsing', { skip: true }, (t) => {
|
|
501
474
|
const components = URI.parse('uri://us\xA0er:pa\uD7FFss@example.com:123/o\uF900ne/t\uFDCFwo.t\uFDF0hree?q1=a1\uF8FF\uE000&q2=a2#bo\uFFEFdy', IRI_OPTION)
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
475
|
+
t.equal(components.error, undefined, 'all errors')
|
|
476
|
+
t.equal(components.scheme, 'uri', 'scheme')
|
|
477
|
+
t.equal(components.userinfo, 'us\xA0er:pa\uD7FFss', 'userinfo')
|
|
478
|
+
t.equal(components.host, 'example.com', 'host')
|
|
479
|
+
t.equal(components.port, 123, 'port')
|
|
480
|
+
t.equal(components.path, '/o\uF900ne/t\uFDCFwo.t\uFDF0hree', 'path')
|
|
481
|
+
t.equal(components.query, 'q1=a1\uF8FF\uE000&q2=a2', 'query')
|
|
482
|
+
t.equal(components.fragment, 'bo\uFFEFdy', 'fragment')
|
|
483
|
+
t.end()
|
|
511
484
|
})
|
|
512
485
|
|
|
513
|
-
test('IRI Serialization', { skip: true },
|
|
486
|
+
test('IRI Serialization', { skip: true }, (t) => {
|
|
514
487
|
const components = {
|
|
515
488
|
scheme: 'uri',
|
|
516
489
|
userinfo: 'us\xA0er:pa\uD7FFss',
|
|
@@ -520,421 +493,420 @@ test('IRI Serialization', { skip: true }, function () {
|
|
|
520
493
|
query: 'q1=a1\uF8FF\uE000&q2=a2',
|
|
521
494
|
fragment: 'bo\uFFEFdy\uE001'
|
|
522
495
|
}
|
|
523
|
-
|
|
496
|
+
t.equal(URI.serialize(components, IRI_OPTION), 'uri://us\xA0er:pa\uD7FFss@example.com:123/o\uF900ne/t\uFDCFwo.t\uFDF0hree?q1=a1\uF8FF\uE000&q2=a2#bo\uFFEFdy%EE%80%81')
|
|
497
|
+
t.end()
|
|
524
498
|
})
|
|
525
499
|
|
|
526
|
-
test('IRI Normalizing', { skip: true },
|
|
527
|
-
|
|
500
|
+
test('IRI Normalizing', { skip: true }, (t) => {
|
|
501
|
+
t.equal(URI.normalize('uri://www.example.org/red%09ros\xE9#red', IRI_OPTION), 'uri://www.example.org/red%09ros\xE9#red')
|
|
502
|
+
t.end()
|
|
528
503
|
})
|
|
529
504
|
|
|
530
|
-
test('IRI Equals', { skip: true },
|
|
505
|
+
test('IRI Equals', { skip: true }, (t) => {
|
|
531
506
|
// example from RFC 3987
|
|
532
|
-
|
|
507
|
+
t.equal(URI.equal('example://a/b/c/%7Bfoo%7D/ros\xE9', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d/ros%C3%A9', IRI_OPTION), true)
|
|
508
|
+
t.end()
|
|
533
509
|
})
|
|
534
510
|
|
|
535
|
-
test('Convert IRI to URI', { skip: true },
|
|
511
|
+
test('Convert IRI to URI', { skip: true }, (t) => {
|
|
536
512
|
// example from RFC 3987
|
|
537
|
-
|
|
513
|
+
t.equal(URI.serialize(URI.parse('uri://www.example.org/red%09ros\xE9#red', IRI_OPTION)), 'uri://www.example.org/red%09ros%C3%A9#red')
|
|
538
514
|
|
|
539
515
|
// Internationalized Domain Name conversion via punycode example from RFC 3987
|
|
540
|
-
|
|
516
|
+
t.equal(URI.serialize(URI.parse('uri://r\xE9sum\xE9.example.org', { iri: true, domainHost: true }), { domainHost: true }), 'uri://xn--rsum-bpad.example.org')
|
|
517
|
+
t.end()
|
|
541
518
|
})
|
|
542
519
|
|
|
543
|
-
test('Convert URI to IRI', { skip: true },
|
|
520
|
+
test('Convert URI to IRI', { skip: true }, (t) => {
|
|
544
521
|
// examples from RFC 3987
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
522
|
+
t.equal(URI.serialize(URI.parse('uri://www.example.org/D%C3%BCrst'), IRI_OPTION), 'uri://www.example.org/D\xFCrst')
|
|
523
|
+
t.equal(URI.serialize(URI.parse('uri://www.example.org/D%FCrst'), IRI_OPTION), 'uri://www.example.org/D%FCrst')
|
|
524
|
+
t.equal(URI.serialize(URI.parse('uri://xn--99zt52a.example.org/%e2%80%ae'), IRI_OPTION), 'uri://xn--99zt52a.example.org/%E2%80%AE') // or uri://\u7D0D\u8C46.example.org/%E2%80%AE
|
|
548
525
|
|
|
549
526
|
// Internationalized Domain Name conversion via punycode example from RFC 3987
|
|
550
|
-
|
|
527
|
+
t.equal(URI.serialize(URI.parse('uri://xn--rsum-bpad.example.org', { domainHost: true }), { iri: true, domainHost: true }), 'uri://r\xE9sum\xE9.example.org')
|
|
528
|
+
t.end()
|
|
551
529
|
})
|
|
552
530
|
|
|
553
|
-
//
|
|
554
|
-
// HTTP
|
|
555
|
-
//
|
|
556
|
-
|
|
557
531
|
if (URI.SCHEMES.http) {
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
test('HTTP Equals', function () {
|
|
532
|
+
test('HTTP Equals', (t) => {
|
|
561
533
|
// test from RFC 2616
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
534
|
+
t.equal(URI.equal('http://abc.com:80/~smith/home.html', 'http://abc.com/~smith/home.html'), true)
|
|
535
|
+
t.equal(URI.equal('http://ABC.com/%7Esmith/home.html', 'http://abc.com/~smith/home.html'), true)
|
|
536
|
+
t.equal(URI.equal('http://ABC.com:/%7esmith/home.html', 'http://abc.com/~smith/home.html'), true)
|
|
537
|
+
t.equal(URI.equal('HTTP://ABC.COM', 'http://abc.com/'), true)
|
|
566
538
|
// test from RFC 3986
|
|
567
|
-
|
|
539
|
+
t.equal(URI.equal('http://example.com:/', 'http://example.com:80/'), true)
|
|
540
|
+
t.end()
|
|
568
541
|
})
|
|
569
542
|
}
|
|
570
543
|
|
|
571
544
|
if (URI.SCHEMES.https) {
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
strictEqual(URI.equal('https://example.com:/', 'https://example.com:443/'), true)
|
|
545
|
+
test('HTTPS Equals', (t) => {
|
|
546
|
+
t.equal(URI.equal('https://example.com', 'https://example.com:443/'), true)
|
|
547
|
+
t.equal(URI.equal('https://example.com:/', 'https://example.com:443/'), true)
|
|
548
|
+
t.end()
|
|
577
549
|
})
|
|
578
550
|
}
|
|
579
551
|
|
|
580
|
-
//
|
|
581
|
-
// URN
|
|
582
|
-
//
|
|
583
|
-
|
|
584
552
|
if (URI.SCHEMES.urn) {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
test('URN Parsing', function () {
|
|
553
|
+
test('URN Parsing', (t) => {
|
|
588
554
|
// example from RFC 2141
|
|
589
555
|
const components = URI.parse('urn:foo:a123,456')
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
556
|
+
t.equal(components.error, undefined, 'errors')
|
|
557
|
+
t.equal(components.scheme, 'urn', 'scheme')
|
|
558
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
559
|
+
t.equal(components.host, undefined, 'host')
|
|
560
|
+
t.equal(components.port, undefined, 'port')
|
|
561
|
+
t.equal(components.path, undefined, 'path')
|
|
562
|
+
t.equal(components.query, undefined, 'query')
|
|
563
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
564
|
+
t.equal(components.nid, 'foo', 'nid')
|
|
565
|
+
t.equal(components.nss, 'a123,456', 'nss')
|
|
566
|
+
t.end()
|
|
601
567
|
})
|
|
602
568
|
|
|
603
|
-
test('URN Serialization',
|
|
569
|
+
test('URN Serialization', (t) => {
|
|
604
570
|
// example from RFC 2141
|
|
605
571
|
const components = {
|
|
606
572
|
scheme: 'urn',
|
|
607
573
|
nid: 'foo',
|
|
608
574
|
nss: 'a123,456'
|
|
609
575
|
}
|
|
610
|
-
|
|
576
|
+
t.equal(URI.serialize(components), 'urn:foo:a123,456')
|
|
577
|
+
t.end()
|
|
611
578
|
})
|
|
612
579
|
|
|
613
|
-
test('URN Equals', { skip: true },
|
|
580
|
+
test('URN Equals', { skip: true }, (t) => {
|
|
614
581
|
// test from RFC 2141
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
582
|
+
t.equal(URI.equal('urn:foo:a123,456', 'urn:foo:a123,456'), true)
|
|
583
|
+
t.equal(URI.equal('urn:foo:a123,456', 'URN:foo:a123,456'), true)
|
|
584
|
+
t.equal(URI.equal('urn:foo:a123,456', 'urn:FOO:a123,456'), true)
|
|
585
|
+
t.equal(URI.equal('urn:foo:a123,456', 'urn:foo:A123,456'), false)
|
|
586
|
+
t.equal(URI.equal('urn:foo:a123%2C456', 'URN:FOO:a123%2c456'), true)
|
|
587
|
+
t.end()
|
|
620
588
|
})
|
|
621
589
|
|
|
622
|
-
test('URN Resolving',
|
|
590
|
+
test('URN Resolving', (t) => {
|
|
623
591
|
// example from epoberezkin
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
592
|
+
t.equal(URI.resolve('', 'urn:some:ip:prop'), 'urn:some:ip:prop')
|
|
593
|
+
t.equal(URI.resolve('#', 'urn:some:ip:prop'), 'urn:some:ip:prop')
|
|
594
|
+
t.equal(URI.resolve('urn:some:ip:prop', 'urn:some:ip:prop'), 'urn:some:ip:prop')
|
|
595
|
+
t.equal(URI.resolve('urn:some:other:prop', 'urn:some:ip:prop'), 'urn:some:ip:prop')
|
|
596
|
+
t.end()
|
|
628
597
|
})
|
|
629
598
|
|
|
630
|
-
|
|
631
|
-
// URN UUID
|
|
632
|
-
//
|
|
633
|
-
|
|
634
|
-
test('UUID Parsing', function () {
|
|
599
|
+
test('UUID Parsing', (t) => {
|
|
635
600
|
// example from RFC 4122
|
|
636
601
|
let components = URI.parse('urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6')
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
strictEqual(components.uuid, 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6', 'uuid')
|
|
602
|
+
t.equal(components.error, undefined, 'errors')
|
|
603
|
+
t.equal(components.scheme, 'urn', 'scheme')
|
|
604
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
605
|
+
t.equal(components.host, undefined, 'host')
|
|
606
|
+
t.equal(components.port, undefined, 'port')
|
|
607
|
+
t.equal(components.path, undefined, 'path')
|
|
608
|
+
t.equal(components.query, undefined, 'query')
|
|
609
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
610
|
+
t.equal(components.nid, 'uuid', 'nid')
|
|
611
|
+
t.equal(components.nss, undefined, 'nss')
|
|
612
|
+
t.equal(components.uuid, 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6', 'uuid')
|
|
649
613
|
|
|
650
614
|
components = URI.parse('urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6')
|
|
651
|
-
|
|
615
|
+
t.notEqual(components.error, undefined, 'errors')
|
|
616
|
+
t.end()
|
|
652
617
|
})
|
|
653
618
|
|
|
654
|
-
test('UUID Serialization',
|
|
619
|
+
test('UUID Serialization', (t) => {
|
|
655
620
|
// example from RFC 4122
|
|
656
621
|
let components = {
|
|
657
622
|
scheme: 'urn',
|
|
658
623
|
nid: 'uuid',
|
|
659
624
|
uuid: 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6'
|
|
660
625
|
}
|
|
661
|
-
|
|
626
|
+
t.equal(URI.serialize(components), 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6')
|
|
662
627
|
|
|
663
628
|
components = {
|
|
664
629
|
scheme: 'urn',
|
|
665
630
|
nid: 'uuid',
|
|
666
631
|
uuid: 'notauuid-7dec-11d0-a765-00a0c91e6bf6'
|
|
667
632
|
}
|
|
668
|
-
|
|
633
|
+
t.equal(URI.serialize(components), 'urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6')
|
|
634
|
+
t.end()
|
|
669
635
|
})
|
|
670
636
|
|
|
671
|
-
test('UUID Equals',
|
|
672
|
-
|
|
637
|
+
test('UUID Equals', (t) => {
|
|
638
|
+
t.equal(URI.equal('URN:UUID:F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6', 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6'), true)
|
|
639
|
+
t.end()
|
|
673
640
|
})
|
|
674
641
|
|
|
675
|
-
test('URN NID Override',
|
|
642
|
+
test('URN NID Override', (t) => {
|
|
676
643
|
let components = URI.parse('urn:foo:f81d4fae-7dec-11d0-a765-00a0c91e6bf6', { nid: 'uuid' })
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
644
|
+
t.equal(components.error, undefined, 'errors')
|
|
645
|
+
t.equal(components.scheme, 'urn', 'scheme')
|
|
646
|
+
t.equal(components.path, undefined, 'path')
|
|
647
|
+
t.equal(components.nid, 'foo', 'nid')
|
|
648
|
+
t.equal(components.nss, undefined, 'nss')
|
|
649
|
+
t.equal(components.uuid, 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6', 'uuid')
|
|
683
650
|
|
|
684
651
|
components = {
|
|
685
652
|
scheme: 'urn',
|
|
686
653
|
nid: 'foo',
|
|
687
654
|
uuid: 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6'
|
|
688
655
|
}
|
|
689
|
-
|
|
656
|
+
t.equal(URI.serialize(components, { nid: 'uuid' }), 'urn:foo:f81d4fae-7dec-11d0-a765-00a0c91e6bf6')
|
|
657
|
+
t.end()
|
|
690
658
|
})
|
|
691
659
|
}
|
|
692
660
|
|
|
693
|
-
//
|
|
694
|
-
// Mailto
|
|
695
|
-
//
|
|
696
|
-
|
|
697
661
|
if (URI.SCHEMES.mailto) {
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
test('Mailto Parse', function () {
|
|
662
|
+
test('Mailto Parse', (t) => {
|
|
701
663
|
let components
|
|
702
664
|
|
|
703
665
|
// tests from RFC 6068
|
|
704
666
|
|
|
705
667
|
components = URI.parse('mailto:chris@example.com')
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
deepEqual(components.to, ['chris@example.com'], 'to')
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
668
|
+
t.equal(components.error, undefined, 'error')
|
|
669
|
+
t.equal(components.scheme, 'mailto', 'scheme')
|
|
670
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
671
|
+
t.equal(components.host, undefined, 'host')
|
|
672
|
+
t.equal(components.port, undefined, 'port')
|
|
673
|
+
t.equal(components.path, undefined, 'path')
|
|
674
|
+
t.equal(components.query, undefined, 'query')
|
|
675
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
676
|
+
t.deepEqual(components.to, ['chris@example.com'], 'to')
|
|
677
|
+
t.equal(components.subject, undefined, 'subject')
|
|
678
|
+
t.equal(components.body, undefined, 'body')
|
|
679
|
+
t.equal(components.headers, undefined, 'headers')
|
|
718
680
|
|
|
719
681
|
components = URI.parse('mailto:infobot@example.com?subject=current-issue')
|
|
720
|
-
deepEqual(components.to, ['infobot@example.com'], 'to')
|
|
721
|
-
|
|
682
|
+
t.deepEqual(components.to, ['infobot@example.com'], 'to')
|
|
683
|
+
t.equal(components.subject, 'current-issue', 'subject')
|
|
722
684
|
|
|
723
685
|
components = URI.parse('mailto:infobot@example.com?body=send%20current-issue')
|
|
724
|
-
deepEqual(components.to, ['infobot@example.com'], 'to')
|
|
725
|
-
|
|
686
|
+
t.deepEqual(components.to, ['infobot@example.com'], 'to')
|
|
687
|
+
t.equal(components.body, 'send current-issue', 'body')
|
|
726
688
|
|
|
727
689
|
components = URI.parse('mailto:infobot@example.com?body=send%20current-issue%0D%0Asend%20index')
|
|
728
|
-
deepEqual(components.to, ['infobot@example.com'], 'to')
|
|
729
|
-
|
|
690
|
+
t.deepEqual(components.to, ['infobot@example.com'], 'to')
|
|
691
|
+
t.equal(components.body, 'send current-issue\x0D\x0Asend index', 'body')
|
|
730
692
|
|
|
731
693
|
components = URI.parse('mailto:list@example.org?In-Reply-To=%3C3469A91.D10AF4C@example.com%3E')
|
|
732
|
-
deepEqual(components.to, ['list@example.org'], 'to')
|
|
733
|
-
deepEqual(components.headers, { 'In-Reply-To': '<3469A91.D10AF4C@example.com>' }, 'headers')
|
|
694
|
+
t.deepEqual(components.to, ['list@example.org'], 'to')
|
|
695
|
+
t.deepEqual(components.headers, { 'In-Reply-To': '<3469A91.D10AF4C@example.com>' }, 'headers')
|
|
734
696
|
|
|
735
697
|
components = URI.parse('mailto:majordomo@example.com?body=subscribe%20bamboo-l')
|
|
736
|
-
deepEqual(components.to, ['majordomo@example.com'], 'to')
|
|
737
|
-
|
|
698
|
+
t.deepEqual(components.to, ['majordomo@example.com'], 'to')
|
|
699
|
+
t.equal(components.body, 'subscribe bamboo-l', 'body')
|
|
738
700
|
|
|
739
701
|
components = URI.parse('mailto:joe@example.com?cc=bob@example.com&body=hello')
|
|
740
|
-
deepEqual(components.to, ['joe@example.com'], 'to')
|
|
741
|
-
|
|
742
|
-
deepEqual(components.headers, { cc: 'bob@example.com' }, 'headers')
|
|
702
|
+
t.deepEqual(components.to, ['joe@example.com'], 'to')
|
|
703
|
+
t.equal(components.body, 'hello', 'body')
|
|
704
|
+
t.deepEqual(components.headers, { cc: 'bob@example.com' }, 'headers')
|
|
743
705
|
|
|
744
706
|
components = URI.parse('mailto:joe@example.com?cc=bob@example.com?body=hello')
|
|
745
|
-
if (URI.VALIDATE_SUPPORT) ok(components.error, 'invalid header fields')
|
|
707
|
+
if (URI.VALIDATE_SUPPORT) t.ok(components.error, 'invalid header fields')
|
|
746
708
|
|
|
747
709
|
components = URI.parse('mailto:gorby%25kremvax@example.com')
|
|
748
|
-
deepEqual(components.to, ['gorby%kremvax@example.com'], 'to gorby%kremvax@example.com')
|
|
710
|
+
t.deepEqual(components.to, ['gorby%kremvax@example.com'], 'to gorby%kremvax@example.com')
|
|
749
711
|
|
|
750
712
|
components = URI.parse('mailto:unlikely%3Faddress@example.com?blat=foop')
|
|
751
|
-
deepEqual(components.to, ['unlikely?address@example.com'], 'to unlikely?address@example.com')
|
|
752
|
-
deepEqual(components.headers, { blat: 'foop' }, 'headers')
|
|
713
|
+
t.deepEqual(components.to, ['unlikely?address@example.com'], 'to unlikely?address@example.com')
|
|
714
|
+
t.deepEqual(components.headers, { blat: 'foop' }, 'headers')
|
|
753
715
|
|
|
754
716
|
components = URI.parse('mailto:Mike%26family@example.org')
|
|
755
|
-
deepEqual(components.to, ['Mike&family@example.org'], 'to Mike&family@example.org')
|
|
717
|
+
t.deepEqual(components.to, ['Mike&family@example.org'], 'to Mike&family@example.org')
|
|
756
718
|
|
|
757
719
|
components = URI.parse('mailto:%22not%40me%22@example.org')
|
|
758
|
-
deepEqual(components.to, ['"not@me"@example.org'], 'to ' + '"not@me"@example.org')
|
|
720
|
+
t.deepEqual(components.to, ['"not@me"@example.org'], 'to ' + '"not@me"@example.org')
|
|
759
721
|
|
|
760
722
|
components = URI.parse('mailto:%22oh%5C%5Cno%22@example.org')
|
|
761
|
-
deepEqual(components.to, ['"oh\\\\no"@example.org'], 'to ' + '"oh\\\\no"@example.org')
|
|
723
|
+
t.deepEqual(components.to, ['"oh\\\\no"@example.org'], 'to ' + '"oh\\\\no"@example.org')
|
|
762
724
|
|
|
763
725
|
components = URI.parse("mailto:%22%5C%5C%5C%22it's%5C%20ugly%5C%5C%5C%22%22@example.org")
|
|
764
|
-
deepEqual(components.to, ['"\\\\\\"it\'s\\ ugly\\\\\\""@example.org'], 'to ' + '"\\\\\\"it\'s\\ ugly\\\\\\""@example.org')
|
|
726
|
+
t.deepEqual(components.to, ['"\\\\\\"it\'s\\ ugly\\\\\\""@example.org'], 'to ' + '"\\\\\\"it\'s\\ ugly\\\\\\""@example.org')
|
|
765
727
|
|
|
766
728
|
components = URI.parse('mailto:user@example.org?subject=caf%C3%A9')
|
|
767
|
-
deepEqual(components.to, ['user@example.org'], 'to')
|
|
768
|
-
|
|
729
|
+
t.deepEqual(components.to, ['user@example.org'], 'to')
|
|
730
|
+
t.equal(components.subject, 'caf\xE9', 'subject')
|
|
769
731
|
|
|
770
732
|
components = URI.parse('mailto:user@example.org?subject=%3D%3Futf-8%3FQ%3Fcaf%3DC3%3DA9%3F%3D')
|
|
771
|
-
deepEqual(components.to, ['user@example.org'], 'to')
|
|
772
|
-
|
|
733
|
+
t.deepEqual(components.to, ['user@example.org'], 'to')
|
|
734
|
+
t.equal(components.subject, '=?utf-8?Q?caf=C3=A9?=', 'subject') // TODO: Verify this
|
|
773
735
|
|
|
774
736
|
components = URI.parse('mailto:user@example.org?subject=%3D%3Fiso-8859-1%3FQ%3Fcaf%3DE9%3F%3D')
|
|
775
|
-
deepEqual(components.to, ['user@example.org'], 'to')
|
|
776
|
-
|
|
737
|
+
t.deepEqual(components.to, ['user@example.org'], 'to')
|
|
738
|
+
t.equal(components.subject, '=?iso-8859-1?Q?caf=E9?=', 'subject') // TODO: Verify this
|
|
777
739
|
|
|
778
740
|
components = URI.parse('mailto:user@example.org?subject=caf%C3%A9&body=caf%C3%A9')
|
|
779
|
-
deepEqual(components.to, ['user@example.org'], 'to')
|
|
780
|
-
|
|
781
|
-
|
|
741
|
+
t.deepEqual(components.to, ['user@example.org'], 'to')
|
|
742
|
+
t.equal(components.subject, 'caf\xE9', 'subject')
|
|
743
|
+
t.equal(components.body, 'caf\xE9', 'body')
|
|
782
744
|
|
|
783
745
|
if (URI.IRI_SUPPORT) {
|
|
784
746
|
components = URI.parse('mailto:user@%E7%B4%8D%E8%B1%86.example.org?subject=Test&body=NATTO')
|
|
785
|
-
deepEqual(components.to, ['user@xn--99zt52a.example.org'], 'to')
|
|
786
|
-
|
|
787
|
-
|
|
747
|
+
t.deepEqual(components.to, ['user@xn--99zt52a.example.org'], 'to')
|
|
748
|
+
t.equal(components.subject, 'Test', 'subject')
|
|
749
|
+
t.equal(components.body, 'NATTO', 'body')
|
|
788
750
|
}
|
|
751
|
+
|
|
752
|
+
t.end()
|
|
789
753
|
})
|
|
790
754
|
|
|
791
|
-
test('Mailto Serialize',
|
|
755
|
+
test('Mailto Serialize', (t) => {
|
|
792
756
|
// tests from RFC 6068
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
757
|
+
t.equal(URI.serialize({ scheme: 'mailto', to: ['chris@example.com'] }), 'mailto:chris@example.com')
|
|
758
|
+
t.equal(URI.serialize({ scheme: 'mailto', to: ['infobot@example.com'], body: 'current-issue' }), 'mailto:infobot@example.com?body=current-issue')
|
|
759
|
+
t.equal(URI.serialize({ scheme: 'mailto', to: ['infobot@example.com'], body: 'send current-issue' }), 'mailto:infobot@example.com?body=send%20current-issue')
|
|
760
|
+
t.equal(URI.serialize({ scheme: 'mailto', to: ['infobot@example.com'], body: 'send current-issue\x0D\x0Asend index' }), 'mailto:infobot@example.com?body=send%20current-issue%0D%0Asend%20index')
|
|
761
|
+
t.equal(URI.serialize({ scheme: 'mailto', to: ['list@example.org'], headers: { 'In-Reply-To': '<3469A91.D10AF4C@example.com>' } }), 'mailto:list@example.org?In-Reply-To=%3C3469A91.D10AF4C@example.com%3E')
|
|
762
|
+
t.equal(URI.serialize({ scheme: 'mailto', to: ['majordomo@example.com'], body: 'subscribe bamboo-l' }), 'mailto:majordomo@example.com?body=subscribe%20bamboo-l')
|
|
763
|
+
t.equal(URI.serialize({ scheme: 'mailto', to: ['joe@example.com'], headers: { cc: 'bob@example.com', body: 'hello' } }), 'mailto:joe@example.com?cc=bob@example.com&body=hello')
|
|
764
|
+
t.equal(URI.serialize({ scheme: 'mailto', to: ['gorby%25kremvax@example.com'] }), 'mailto:gorby%25kremvax@example.com')
|
|
765
|
+
t.equal(URI.serialize({ scheme: 'mailto', to: ['unlikely%3Faddress@example.com'], headers: { blat: 'foop' } }), 'mailto:unlikely%3Faddress@example.com?blat=foop')
|
|
766
|
+
t.equal(URI.serialize({ scheme: 'mailto', to: ['Mike&family@example.org'] }), 'mailto:Mike%26family@example.org')
|
|
767
|
+
t.equal(URI.serialize({ scheme: 'mailto', to: ['"not@me"@example.org'] }), 'mailto:%22not%40me%22@example.org')
|
|
768
|
+
t.equal(URI.serialize({ scheme: 'mailto', to: ['"oh\\\\no"@example.org'] }), 'mailto:%22oh%5C%5Cno%22@example.org')
|
|
769
|
+
t.equal(URI.serialize({ scheme: 'mailto', to: ['"\\\\\\"it\'s\\ ugly\\\\\\""@example.org'] }), "mailto:%22%5C%5C%5C%22it's%5C%20ugly%5C%5C%5C%22%22@example.org")
|
|
770
|
+
t.equal(URI.serialize({ scheme: 'mailto', to: ['user@example.org'], subject: 'caf\xE9' }), 'mailto:user@example.org?subject=caf%C3%A9')
|
|
771
|
+
t.equal(URI.serialize({ scheme: 'mailto', to: ['user@example.org'], subject: '=?utf-8?Q?caf=C3=A9?=' }), 'mailto:user@example.org?subject=%3D%3Futf-8%3FQ%3Fcaf%3DC3%3DA9%3F%3D')
|
|
772
|
+
t.equal(URI.serialize({ scheme: 'mailto', to: ['user@example.org'], subject: '=?iso-8859-1?Q?caf=E9?=' }), 'mailto:user@example.org?subject=%3D%3Fiso-8859-1%3FQ%3Fcaf%3DE9%3F%3D')
|
|
773
|
+
t.equal(URI.serialize({ scheme: 'mailto', to: ['user@example.org'], subject: 'caf\xE9', body: 'caf\xE9' }), 'mailto:user@example.org?subject=caf%C3%A9&body=caf%C3%A9')
|
|
810
774
|
if (URI.IRI_SUPPORT) {
|
|
811
|
-
|
|
775
|
+
t.equal(URI.serialize({ scheme: 'mailto', to: ['us\xE9r@\u7d0d\u8c46.example.org'], subject: 'Test', body: 'NATTO' }), 'mailto:us%C3%A9r@xn--99zt52a.example.org?subject=Test&body=NATTO')
|
|
812
776
|
}
|
|
777
|
+
t.end()
|
|
813
778
|
})
|
|
814
779
|
|
|
815
|
-
test('Mailto Equals',
|
|
780
|
+
test('Mailto Equals', (t) => {
|
|
816
781
|
// tests from RFC 6068
|
|
817
|
-
|
|
818
|
-
|
|
782
|
+
t.equal(URI.equal('mailto:addr1@an.example,addr2@an.example', 'mailto:?to=addr1@an.example,addr2@an.example'), true)
|
|
783
|
+
t.equal(URI.equal('mailto:?to=addr1@an.example,addr2@an.example', 'mailto:addr1@an.example?to=addr2@an.example'), true)
|
|
784
|
+
t.end()
|
|
819
785
|
})
|
|
820
786
|
}
|
|
821
787
|
|
|
822
788
|
if (URI.SCHEMES.ws) {
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
test('WS Parse', function () {
|
|
789
|
+
test('WS Parse', (t) => {
|
|
826
790
|
let components
|
|
827
791
|
|
|
828
792
|
// example from RFC 6455, Sec 4.1
|
|
829
793
|
components = URI.parse('ws://example.com/chat')
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
794
|
+
t.equal(components.error, undefined, 'error')
|
|
795
|
+
t.equal(components.scheme, 'ws', 'scheme')
|
|
796
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
797
|
+
t.equal(components.host, 'example.com', 'host')
|
|
798
|
+
t.equal(components.port, undefined, 'port')
|
|
799
|
+
t.equal(components.path, undefined, 'path')
|
|
800
|
+
t.equal(components.query, undefined, 'query')
|
|
801
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
802
|
+
t.equal(components.resourceName, '/chat', 'resourceName')
|
|
803
|
+
t.equal(components.secure, false, 'secure')
|
|
840
804
|
|
|
841
805
|
components = URI.parse('ws://example.com/foo?bar=baz')
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
806
|
+
t.equal(components.error, undefined, 'error')
|
|
807
|
+
t.equal(components.scheme, 'ws', 'scheme')
|
|
808
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
809
|
+
t.equal(components.host, 'example.com', 'host')
|
|
810
|
+
t.equal(components.port, undefined, 'port')
|
|
811
|
+
t.equal(components.path, undefined, 'path')
|
|
812
|
+
t.equal(components.query, undefined, 'query')
|
|
813
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
814
|
+
t.equal(components.resourceName, '/foo?bar=baz', 'resourceName')
|
|
815
|
+
t.equal(components.secure, false, 'secure')
|
|
852
816
|
|
|
853
817
|
components = URI.parse('ws://example.com/?bar=baz')
|
|
854
|
-
|
|
818
|
+
t.equal(components.resourceName, '/?bar=baz', 'resourceName')
|
|
819
|
+
|
|
820
|
+
t.end()
|
|
855
821
|
})
|
|
856
822
|
|
|
857
|
-
test('WS Serialize',
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
823
|
+
test('WS Serialize', (t) => {
|
|
824
|
+
t.equal(URI.serialize({ scheme: 'ws' }), 'ws:')
|
|
825
|
+
t.equal(URI.serialize({ scheme: 'ws', host: 'example.com' }), 'ws://example.com')
|
|
826
|
+
t.equal(URI.serialize({ scheme: 'ws', resourceName: '/' }), 'ws:')
|
|
827
|
+
t.equal(URI.serialize({ scheme: 'ws', resourceName: '/foo' }), 'ws:/foo')
|
|
828
|
+
t.equal(URI.serialize({ scheme: 'ws', resourceName: '/foo?bar' }), 'ws:/foo?bar')
|
|
829
|
+
t.equal(URI.serialize({ scheme: 'ws', secure: false }), 'ws:')
|
|
830
|
+
t.equal(URI.serialize({ scheme: 'ws', secure: true }), 'wss:')
|
|
831
|
+
t.equal(URI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo' }), 'ws://example.com/foo')
|
|
832
|
+
t.equal(URI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar' }), 'ws://example.com/foo?bar')
|
|
833
|
+
t.equal(URI.serialize({ scheme: 'ws', host: 'example.com', secure: false }), 'ws://example.com')
|
|
834
|
+
t.equal(URI.serialize({ scheme: 'ws', host: 'example.com', secure: true }), 'wss://example.com')
|
|
835
|
+
t.equal(URI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: false }), 'ws://example.com/foo?bar')
|
|
836
|
+
t.equal(URI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: true }), 'wss://example.com/foo?bar')
|
|
837
|
+
t.end()
|
|
871
838
|
})
|
|
872
839
|
|
|
873
|
-
test('WS Equal',
|
|
874
|
-
|
|
840
|
+
test('WS Equal', (t) => {
|
|
841
|
+
t.equal(URI.equal('WS://ABC.COM:80/chat#one', 'ws://abc.com/chat'), true)
|
|
842
|
+
t.end()
|
|
875
843
|
})
|
|
876
844
|
|
|
877
|
-
test('WS Normalize',
|
|
878
|
-
|
|
845
|
+
test('WS Normalize', (t) => {
|
|
846
|
+
t.equal(URI.normalize('ws://example.com:80/foo#hash'), 'ws://example.com/foo')
|
|
847
|
+
t.end()
|
|
879
848
|
})
|
|
880
849
|
}
|
|
881
850
|
|
|
882
851
|
if (URI.SCHEMES.wss) {
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
test('WSS Parse', function () {
|
|
852
|
+
test('WSS Parse', (t) => {
|
|
886
853
|
let components
|
|
887
854
|
|
|
888
855
|
// example from RFC 6455, Sec 4.1
|
|
889
856
|
components = URI.parse('wss://example.com/chat')
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
857
|
+
t.equal(components.error, undefined, 'error')
|
|
858
|
+
t.equal(components.scheme, 'wss', 'scheme')
|
|
859
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
860
|
+
t.equal(components.host, 'example.com', 'host')
|
|
861
|
+
t.equal(components.port, undefined, 'port')
|
|
862
|
+
t.equal(components.path, undefined, 'path')
|
|
863
|
+
t.equal(components.query, undefined, 'query')
|
|
864
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
865
|
+
t.equal(components.resourceName, '/chat', 'resourceName')
|
|
866
|
+
t.equal(components.secure, true, 'secure')
|
|
900
867
|
|
|
901
868
|
components = URI.parse('wss://example.com/foo?bar=baz')
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
869
|
+
t.equal(components.error, undefined, 'error')
|
|
870
|
+
t.equal(components.scheme, 'wss', 'scheme')
|
|
871
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
872
|
+
t.equal(components.host, 'example.com', 'host')
|
|
873
|
+
t.equal(components.port, undefined, 'port')
|
|
874
|
+
t.equal(components.path, undefined, 'path')
|
|
875
|
+
t.equal(components.query, undefined, 'query')
|
|
876
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
877
|
+
t.equal(components.resourceName, '/foo?bar=baz', 'resourceName')
|
|
878
|
+
t.equal(components.secure, true, 'secure')
|
|
912
879
|
|
|
913
880
|
components = URI.parse('wss://example.com/?bar=baz')
|
|
914
|
-
|
|
881
|
+
t.equal(components.resourceName, '/?bar=baz', 'resourceName')
|
|
882
|
+
|
|
883
|
+
t.end()
|
|
915
884
|
})
|
|
916
885
|
|
|
917
|
-
test('WSS Serialize',
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
886
|
+
test('WSS Serialize', (t) => {
|
|
887
|
+
t.equal(URI.serialize({ scheme: 'wss' }), 'wss:')
|
|
888
|
+
t.equal(URI.serialize({ scheme: 'wss', host: 'example.com' }), 'wss://example.com')
|
|
889
|
+
t.equal(URI.serialize({ scheme: 'wss', resourceName: '/' }), 'wss:')
|
|
890
|
+
t.equal(URI.serialize({ scheme: 'wss', resourceName: '/foo' }), 'wss:/foo')
|
|
891
|
+
t.equal(URI.serialize({ scheme: 'wss', resourceName: '/foo?bar' }), 'wss:/foo?bar')
|
|
892
|
+
t.equal(URI.serialize({ scheme: 'wss', secure: false }), 'ws:')
|
|
893
|
+
t.equal(URI.serialize({ scheme: 'wss', secure: true }), 'wss:')
|
|
894
|
+
t.equal(URI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo' }), 'wss://example.com/foo')
|
|
895
|
+
t.equal(URI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar' }), 'wss://example.com/foo?bar')
|
|
896
|
+
t.equal(URI.serialize({ scheme: 'wss', host: 'example.com', secure: false }), 'ws://example.com')
|
|
897
|
+
t.equal(URI.serialize({ scheme: 'wss', host: 'example.com', secure: true }), 'wss://example.com')
|
|
898
|
+
t.equal(URI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar', secure: false }), 'ws://example.com/foo?bar')
|
|
899
|
+
t.equal(URI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar', secure: true }), 'wss://example.com/foo?bar')
|
|
900
|
+
t.end()
|
|
931
901
|
})
|
|
932
902
|
|
|
933
|
-
test('WSS Equal',
|
|
934
|
-
|
|
903
|
+
test('WSS Equal', (t) => {
|
|
904
|
+
t.equal(URI.equal('WSS://ABC.COM:443/chat#one', 'wss://abc.com/chat'), true)
|
|
905
|
+
t.end()
|
|
935
906
|
})
|
|
936
907
|
|
|
937
|
-
test('WSS Normalize',
|
|
938
|
-
|
|
908
|
+
test('WSS Normalize', (t) => {
|
|
909
|
+
t.equal(URI.normalize('wss://example.com:443/foo#hash'), 'wss://example.com/foo')
|
|
910
|
+
t.end()
|
|
939
911
|
})
|
|
940
912
|
}
|