webext-schema 7.1.0 → 7.1.1
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/.prettierignore +8 -0
- package/SECURITY.md +1 -7
- package/eslint.config.mjs +28 -14
- package/modules/browser.js +43 -23
- package/modules/commander.js +8 -5
- package/modules/common.js +1 -1
- package/modules/file-util.js +23 -10
- package/modules/schema.js +21 -14
- package/modules/update.js +34 -23
- package/package.json +15 -24
- package/prettier.config.mjs +14 -0
- package/schemas/beta/webext.json +168 -147
- package/schemas/central/webext.json +168 -147
- package/schemas/mail/mailext.json +28 -5
- package/test/browser.test.js +1045 -494
- package/test/commander.test.js +7 -21
- package/test/common.test.js +7 -1
- package/test/file-util.test.js +65 -35
- package/test/index.test.js +16 -8
- package/test/schema.test.js +839 -430
- package/test/update.test.js +839 -510
package/test/update.test.js
CHANGED
|
@@ -14,8 +14,15 @@ import {
|
|
|
14
14
|
|
|
15
15
|
/* test */
|
|
16
16
|
import {
|
|
17
|
-
createUnifiedSchema,
|
|
18
|
-
|
|
17
|
+
createUnifiedSchema,
|
|
18
|
+
fetchText,
|
|
19
|
+
getAllSchemaData,
|
|
20
|
+
getChannelUrl,
|
|
21
|
+
getFileList,
|
|
22
|
+
getListedSchemaData,
|
|
23
|
+
getMailExtSchemaData,
|
|
24
|
+
getSchemaData,
|
|
25
|
+
saveSchemaFile,
|
|
19
26
|
updateSchemas
|
|
20
27
|
} from '../modules/update.js';
|
|
21
28
|
|
|
@@ -36,27 +43,35 @@ describe('fetch text', () => {
|
|
|
36
43
|
|
|
37
44
|
it('should throw', async () => {
|
|
38
45
|
await fetchText().catch(e => {
|
|
39
|
-
assert.deepStrictEqual(
|
|
40
|
-
|
|
46
|
+
assert.deepStrictEqual(
|
|
47
|
+
e,
|
|
48
|
+
new TypeError('Expected String but got Undefined.')
|
|
49
|
+
);
|
|
41
50
|
});
|
|
42
51
|
});
|
|
43
52
|
|
|
44
53
|
it('should throw', async () => {
|
|
45
54
|
const url = new URL('https://example.com');
|
|
46
|
-
mockAgent
|
|
55
|
+
mockAgent
|
|
56
|
+
.get(url.origin)
|
|
57
|
+
.intercept({ path: url.pathname, method: 'GET' })
|
|
47
58
|
.reply(404, {
|
|
48
59
|
ok: false,
|
|
49
60
|
status: 404
|
|
50
61
|
});
|
|
51
62
|
await fetchText('https://example.com').catch(e => {
|
|
52
|
-
assert.deepStrictEqual(
|
|
53
|
-
|
|
63
|
+
assert.deepStrictEqual(
|
|
64
|
+
e,
|
|
65
|
+
new Error('Network response was not ok. status: 404')
|
|
66
|
+
);
|
|
54
67
|
});
|
|
55
68
|
});
|
|
56
69
|
|
|
57
70
|
it('should get result', async () => {
|
|
58
71
|
const url = new URL('https://example.com');
|
|
59
|
-
mockAgent
|
|
72
|
+
mockAgent
|
|
73
|
+
.get(url.origin)
|
|
74
|
+
.intercept({ path: url.pathname, method: 'GET' })
|
|
60
75
|
.reply(200, 'foo');
|
|
61
76
|
const res = await fetchText('https://example.com');
|
|
62
77
|
assert.strictEqual(res, 'foo', 'result');
|
|
@@ -67,7 +82,8 @@ describe('get channel url', () => {
|
|
|
67
82
|
it('should get result', () => {
|
|
68
83
|
const res = getChannelUrl();
|
|
69
84
|
assert.strictEqual(
|
|
70
|
-
res,
|
|
85
|
+
res,
|
|
86
|
+
'https://hg-edge.mozilla.org/releases/mozilla-beta/raw-file/tip/',
|
|
71
87
|
'result'
|
|
72
88
|
);
|
|
73
89
|
});
|
|
@@ -75,7 +91,8 @@ describe('get channel url', () => {
|
|
|
75
91
|
it('should get result', () => {
|
|
76
92
|
const res = getChannelUrl('beta');
|
|
77
93
|
assert.strictEqual(
|
|
78
|
-
res,
|
|
94
|
+
res,
|
|
95
|
+
'https://hg-edge.mozilla.org/releases/mozilla-beta/raw-file/tip/',
|
|
79
96
|
'result'
|
|
80
97
|
);
|
|
81
98
|
});
|
|
@@ -83,7 +100,8 @@ describe('get channel url', () => {
|
|
|
83
100
|
it('should get result', () => {
|
|
84
101
|
const res = getChannelUrl('central');
|
|
85
102
|
assert.strictEqual(
|
|
86
|
-
res,
|
|
103
|
+
res,
|
|
104
|
+
'https://hg-edge.mozilla.org/mozilla-central/raw-file/tip/',
|
|
87
105
|
'result'
|
|
88
106
|
);
|
|
89
107
|
});
|
|
@@ -91,7 +109,8 @@ describe('get channel url', () => {
|
|
|
91
109
|
it('should get result', () => {
|
|
92
110
|
const res = getChannelUrl('mail');
|
|
93
111
|
assert.strictEqual(
|
|
94
|
-
res,
|
|
112
|
+
res,
|
|
113
|
+
'https://hg-edge.mozilla.org/comm-central/raw-file/tip/',
|
|
95
114
|
'result'
|
|
96
115
|
);
|
|
97
116
|
});
|
|
@@ -114,29 +133,39 @@ describe('get schema data', () => {
|
|
|
114
133
|
|
|
115
134
|
it('should throw', async () => {
|
|
116
135
|
await getSchemaData().catch(e => {
|
|
117
|
-
assert.deepStrictEqual(
|
|
118
|
-
|
|
136
|
+
assert.deepStrictEqual(
|
|
137
|
+
e,
|
|
138
|
+
new TypeError('Expected String but got Undefined.')
|
|
139
|
+
);
|
|
119
140
|
});
|
|
120
141
|
});
|
|
121
142
|
|
|
122
143
|
it('should throw', async () => {
|
|
123
144
|
await getSchemaData('foo').catch(e => {
|
|
124
|
-
assert.deepStrictEqual(
|
|
125
|
-
|
|
145
|
+
assert.deepStrictEqual(
|
|
146
|
+
e,
|
|
147
|
+
new TypeError('Expected String but got Undefined.')
|
|
148
|
+
);
|
|
126
149
|
});
|
|
127
150
|
});
|
|
128
151
|
|
|
129
152
|
it('should get object', async () => {
|
|
130
153
|
const url = new URL('https://example.com/foo.json');
|
|
131
|
-
mockAgent
|
|
154
|
+
mockAgent
|
|
155
|
+
.get(url.origin)
|
|
156
|
+
.intercept({ path: url.pathname, method: 'GET' })
|
|
132
157
|
.reply(200, '{ "foo": [ "bar" ] }');
|
|
133
158
|
const res = await getSchemaData('foo.json', 'https://example.com');
|
|
134
|
-
assert.deepEqual(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
159
|
+
assert.deepEqual(
|
|
160
|
+
res,
|
|
161
|
+
{
|
|
162
|
+
file: 'foo.json',
|
|
163
|
+
schema: {
|
|
164
|
+
foo: ['bar']
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
'result'
|
|
168
|
+
);
|
|
140
169
|
});
|
|
141
170
|
});
|
|
142
171
|
|
|
@@ -157,22 +186,33 @@ describe('get schema file list from jar manifest', () => {
|
|
|
157
186
|
|
|
158
187
|
it('should throw', async () => {
|
|
159
188
|
await getFileList().catch(e => {
|
|
160
|
-
assert.deepStrictEqual(
|
|
161
|
-
|
|
189
|
+
assert.deepStrictEqual(
|
|
190
|
+
e,
|
|
191
|
+
new TypeError('Expected String but got Undefined.')
|
|
192
|
+
);
|
|
162
193
|
});
|
|
163
194
|
});
|
|
164
195
|
|
|
165
196
|
it('should get array', async () => {
|
|
166
197
|
const url = new URL('https://example.com/jar.mn');
|
|
167
|
-
mockAgent
|
|
168
|
-
.
|
|
198
|
+
mockAgent
|
|
199
|
+
.get(url.origin)
|
|
200
|
+
.intercept({ path: url.pathname, method: 'GET' })
|
|
201
|
+
.reply(
|
|
202
|
+
200,
|
|
203
|
+
'# comment\n\ntoolkit.jar:\n% content extensions %content/extensions/\n content/extensions/schemas/alarms.json\n content/extensions/schemas/browser_settings.json\n#ifndef ANDROID\n content/extensions/schemas/geckoProfiler.json\n#endif\n content/extensions/schemas/i18n.json\n'
|
|
204
|
+
);
|
|
169
205
|
const res = await getFileList('https://example.com');
|
|
170
|
-
assert.deepEqual(
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
206
|
+
assert.deepEqual(
|
|
207
|
+
res,
|
|
208
|
+
[
|
|
209
|
+
'alarms.json',
|
|
210
|
+
'browser_settings.json',
|
|
211
|
+
'geckoProfiler.json',
|
|
212
|
+
'i18n.json'
|
|
213
|
+
],
|
|
214
|
+
'result'
|
|
215
|
+
);
|
|
176
216
|
});
|
|
177
217
|
});
|
|
178
218
|
|
|
@@ -193,8 +233,10 @@ describe('get all schema data', () => {
|
|
|
193
233
|
|
|
194
234
|
it('should throw', async () => {
|
|
195
235
|
await getAllSchemaData().catch(e => {
|
|
196
|
-
assert.deepStrictEqual(
|
|
197
|
-
|
|
236
|
+
assert.deepStrictEqual(
|
|
237
|
+
e,
|
|
238
|
+
new TypeError('Expected String but got Undefined.')
|
|
239
|
+
);
|
|
198
240
|
});
|
|
199
241
|
});
|
|
200
242
|
|
|
@@ -202,58 +244,78 @@ describe('get all schema data', () => {
|
|
|
202
244
|
const stubInfo = sinon.stub(console, 'info');
|
|
203
245
|
const url = new URL('https://example.com');
|
|
204
246
|
const mockPool = mockAgent.get(url.origin);
|
|
205
|
-
mockPool
|
|
206
|
-
.
|
|
207
|
-
|
|
247
|
+
mockPool
|
|
248
|
+
.intercept({ path: '/jar.mn', method: 'GET' })
|
|
249
|
+
.reply(
|
|
250
|
+
200,
|
|
251
|
+
'content/extensions/schemas/foo.json\ncontent/extensions/schemas/bar.json\n'
|
|
252
|
+
);
|
|
253
|
+
mockPool
|
|
254
|
+
.intercept({ path: '/foo.json', method: 'GET' })
|
|
208
255
|
.reply(200, '{ "foo": "foobar" }');
|
|
209
|
-
mockPool
|
|
256
|
+
mockPool
|
|
257
|
+
.intercept({ path: '/bar.json', method: 'GET' })
|
|
210
258
|
.reply(200, '{ "baz": "qux" }');
|
|
211
259
|
const res = await getAllSchemaData('https://example.com/');
|
|
212
260
|
assert.strictEqual(stubInfo.called, false, 'info');
|
|
213
261
|
stubInfo.restore();
|
|
214
|
-
assert.deepEqual(
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
262
|
+
assert.deepEqual(
|
|
263
|
+
res,
|
|
264
|
+
[
|
|
265
|
+
{
|
|
266
|
+
file: 'foo.json',
|
|
267
|
+
schema: {
|
|
268
|
+
foo: 'foobar'
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
file: 'bar.json',
|
|
273
|
+
schema: {
|
|
274
|
+
baz: 'qux'
|
|
275
|
+
}
|
|
225
276
|
}
|
|
226
|
-
|
|
227
|
-
|
|
277
|
+
],
|
|
278
|
+
'result'
|
|
279
|
+
);
|
|
228
280
|
});
|
|
229
281
|
|
|
230
282
|
it('should get array', async () => {
|
|
231
283
|
const stubInfo = sinon.stub(console, 'info');
|
|
232
284
|
const url = new URL('https://example.com');
|
|
233
285
|
const mockPool = mockAgent.get(url.origin);
|
|
234
|
-
mockPool
|
|
235
|
-
.
|
|
236
|
-
|
|
286
|
+
mockPool
|
|
287
|
+
.intercept({ path: '/jar.mn', method: 'GET' })
|
|
288
|
+
.reply(
|
|
289
|
+
200,
|
|
290
|
+
'content/extensions/schemas/foo.json\ncontent/extensions/schemas/bar.json\n'
|
|
291
|
+
);
|
|
292
|
+
mockPool
|
|
293
|
+
.intercept({ path: '/foo.json', method: 'GET' })
|
|
237
294
|
.reply(200, '{ "foo": "foobar" }');
|
|
238
|
-
mockPool
|
|
295
|
+
mockPool
|
|
296
|
+
.intercept({ path: '/bar.json', method: 'GET' })
|
|
239
297
|
.reply(200, '{ "baz": "qux" }');
|
|
240
298
|
const res = await getAllSchemaData('https://example.com/', true);
|
|
241
299
|
assert.strictEqual(stubInfo.called, true, 'info');
|
|
242
300
|
stubInfo.restore();
|
|
243
|
-
assert.deepEqual(
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
301
|
+
assert.deepEqual(
|
|
302
|
+
res,
|
|
303
|
+
[
|
|
304
|
+
{
|
|
305
|
+
file: 'foo.json',
|
|
306
|
+
schema: {
|
|
307
|
+
foo: 'foobar'
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
file: 'bar.json',
|
|
312
|
+
schema: {
|
|
313
|
+
baz: 'qux'
|
|
314
|
+
}
|
|
254
315
|
}
|
|
255
|
-
|
|
256
|
-
|
|
316
|
+
],
|
|
317
|
+
'result'
|
|
318
|
+
);
|
|
257
319
|
});
|
|
258
320
|
});
|
|
259
321
|
|
|
@@ -274,15 +336,19 @@ describe('get listed schema data', () => {
|
|
|
274
336
|
|
|
275
337
|
it('should throw', async () => {
|
|
276
338
|
await getListedSchemaData().catch(e => {
|
|
277
|
-
assert.deepStrictEqual(
|
|
278
|
-
|
|
339
|
+
assert.deepStrictEqual(
|
|
340
|
+
e,
|
|
341
|
+
new TypeError('Expected String but got Undefined.')
|
|
342
|
+
);
|
|
279
343
|
});
|
|
280
344
|
});
|
|
281
345
|
|
|
282
346
|
it('should throw', async () => {
|
|
283
347
|
await getListedSchemaData('foo').catch(e => {
|
|
284
|
-
assert.deepStrictEqual(
|
|
285
|
-
|
|
348
|
+
assert.deepStrictEqual(
|
|
349
|
+
e,
|
|
350
|
+
new TypeError('Expected Array but got Undefined.')
|
|
351
|
+
);
|
|
286
352
|
});
|
|
287
353
|
});
|
|
288
354
|
|
|
@@ -290,56 +356,73 @@ describe('get listed schema data', () => {
|
|
|
290
356
|
const stubInfo = sinon.stub(console, 'info');
|
|
291
357
|
const url = new URL('https://example.com');
|
|
292
358
|
const mockPool = mockAgent.get(url.origin);
|
|
293
|
-
mockPool
|
|
359
|
+
mockPool
|
|
360
|
+
.intercept({ path: '/foo.json', method: 'GET' })
|
|
294
361
|
.reply(200, '{ "foo": "foobar" }');
|
|
295
|
-
mockPool
|
|
362
|
+
mockPool
|
|
363
|
+
.intercept({ path: '/bar.json', method: 'GET' })
|
|
296
364
|
.reply(200, '{ "baz": "qux" }');
|
|
297
|
-
const res = await getListedSchemaData('https://example.com/',
|
|
298
|
-
|
|
365
|
+
const res = await getListedSchemaData('https://example.com/', [
|
|
366
|
+
'foo.json',
|
|
367
|
+
'bar.json'
|
|
368
|
+
]);
|
|
299
369
|
assert.strictEqual(stubInfo.called, false, 'info');
|
|
300
370
|
stubInfo.restore();
|
|
301
|
-
assert.deepEqual(
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
371
|
+
assert.deepEqual(
|
|
372
|
+
res,
|
|
373
|
+
[
|
|
374
|
+
{
|
|
375
|
+
file: 'foo.json',
|
|
376
|
+
schema: {
|
|
377
|
+
foo: 'foobar'
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
file: 'bar.json',
|
|
382
|
+
schema: {
|
|
383
|
+
baz: 'qux'
|
|
384
|
+
}
|
|
306
385
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
schema: {
|
|
311
|
-
baz: 'qux'
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
], 'result');
|
|
386
|
+
],
|
|
387
|
+
'result'
|
|
388
|
+
);
|
|
315
389
|
});
|
|
316
390
|
|
|
317
391
|
it('should get array', async () => {
|
|
318
392
|
const stubInfo = sinon.stub(console, 'info');
|
|
319
393
|
const url = new URL('https://example.com');
|
|
320
394
|
const mockPool = mockAgent.get(url.origin);
|
|
321
|
-
mockPool
|
|
395
|
+
mockPool
|
|
396
|
+
.intercept({ path: '/foo.json', method: 'GET' })
|
|
322
397
|
.reply(200, '{ "foo": "foobar" }');
|
|
323
|
-
mockPool
|
|
398
|
+
mockPool
|
|
399
|
+
.intercept({ path: '/bar.json', method: 'GET' })
|
|
324
400
|
.reply(200, '{ "baz": "qux" }');
|
|
325
|
-
const res = await getListedSchemaData(
|
|
326
|
-
|
|
401
|
+
const res = await getListedSchemaData(
|
|
402
|
+
'https://example.com/',
|
|
403
|
+
['foo.json', 'bar.json'],
|
|
404
|
+
true
|
|
405
|
+
);
|
|
327
406
|
assert.strictEqual(stubInfo.called, true, 'info');
|
|
328
407
|
stubInfo.restore();
|
|
329
|
-
assert.deepEqual(
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
408
|
+
assert.deepEqual(
|
|
409
|
+
res,
|
|
410
|
+
[
|
|
411
|
+
{
|
|
412
|
+
file: 'foo.json',
|
|
413
|
+
schema: {
|
|
414
|
+
foo: 'foobar'
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
file: 'bar.json',
|
|
419
|
+
schema: {
|
|
420
|
+
baz: 'qux'
|
|
421
|
+
}
|
|
340
422
|
}
|
|
341
|
-
|
|
342
|
-
|
|
423
|
+
],
|
|
424
|
+
'result'
|
|
425
|
+
);
|
|
343
426
|
});
|
|
344
427
|
});
|
|
345
428
|
|
|
@@ -360,8 +443,10 @@ describe('get MailExtensions schema data', () => {
|
|
|
360
443
|
|
|
361
444
|
it('should throw', async () => {
|
|
362
445
|
await getMailExtSchemaData().catch(e => {
|
|
363
|
-
assert.deepStrictEqual(
|
|
364
|
-
|
|
446
|
+
assert.deepStrictEqual(
|
|
447
|
+
e,
|
|
448
|
+
new TypeError('Expected String but got Undefined.')
|
|
449
|
+
);
|
|
365
450
|
});
|
|
366
451
|
});
|
|
367
452
|
|
|
@@ -369,58 +454,78 @@ describe('get MailExtensions schema data', () => {
|
|
|
369
454
|
const stubInfo = sinon.stub(console, 'info');
|
|
370
455
|
const url = new URL('https://example.com');
|
|
371
456
|
const mockPool = mockAgent.get(url.origin);
|
|
372
|
-
mockPool
|
|
373
|
-
.
|
|
374
|
-
|
|
457
|
+
mockPool
|
|
458
|
+
.intercept({ path: '/jar.mn', method: 'GET' })
|
|
459
|
+
.reply(
|
|
460
|
+
200,
|
|
461
|
+
'# comment\n\nmessenger.jar:\n% content/messenger/ext-mail.json\n content/messenger/schemas/accounts.json\n content/messenger/schemas/browserAction.json\n content/messenger/schemas/commands.json\n content/messenger/schemas/pkcs11.json\n'
|
|
462
|
+
);
|
|
463
|
+
mockPool
|
|
464
|
+
.intercept({ path: '/schemas/accounts.json', method: 'GET' })
|
|
375
465
|
.reply(200, '{ "foo": "foobar" }');
|
|
376
|
-
mockPool
|
|
466
|
+
mockPool
|
|
467
|
+
.intercept({ path: '/schemas/browserAction.json', method: 'GET' })
|
|
377
468
|
.reply(200, '{ "bar": "baz" }');
|
|
378
469
|
const res = await getMailExtSchemaData('https://example.com/');
|
|
379
470
|
assert.strictEqual(stubInfo.called, false, 'info');
|
|
380
471
|
stubInfo.restore();
|
|
381
|
-
assert.deepEqual(
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
472
|
+
assert.deepEqual(
|
|
473
|
+
res,
|
|
474
|
+
[
|
|
475
|
+
{
|
|
476
|
+
file: 'accounts.json',
|
|
477
|
+
schema: {
|
|
478
|
+
foo: 'foobar'
|
|
479
|
+
}
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
file: 'browserAction.json',
|
|
483
|
+
schema: {
|
|
484
|
+
bar: 'baz'
|
|
485
|
+
}
|
|
392
486
|
}
|
|
393
|
-
|
|
394
|
-
|
|
487
|
+
],
|
|
488
|
+
'result'
|
|
489
|
+
);
|
|
395
490
|
});
|
|
396
491
|
|
|
397
492
|
it('should get array', async () => {
|
|
398
493
|
const stubInfo = sinon.stub(console, 'info');
|
|
399
494
|
const url = new URL('https://example.com');
|
|
400
495
|
const mockPool = mockAgent.get(url.origin);
|
|
401
|
-
mockPool
|
|
402
|
-
.
|
|
403
|
-
|
|
496
|
+
mockPool
|
|
497
|
+
.intercept({ path: '/jar.mn', method: 'GET' })
|
|
498
|
+
.reply(
|
|
499
|
+
200,
|
|
500
|
+
'# comment\n\nmessenger.jar:\n% content/messenger/ext-mail.json\n content/messenger/schemas/accounts.json\n content/messenger/schemas/browserAction.json\n content/messenger/schemas/commands.json\n content/messenger/schemas/pkcs11.json\n'
|
|
501
|
+
);
|
|
502
|
+
mockPool
|
|
503
|
+
.intercept({ path: '/schemas/accounts.json', method: 'GET' })
|
|
404
504
|
.reply(200, '{ "foo": "foobar" }');
|
|
405
|
-
mockPool
|
|
505
|
+
mockPool
|
|
506
|
+
.intercept({ path: '/schemas/browserAction.json', method: 'GET' })
|
|
406
507
|
.reply(200, '{ "bar": "baz" }');
|
|
407
508
|
const res = await getMailExtSchemaData('https://example.com/', true);
|
|
408
509
|
assert.strictEqual(stubInfo.called, true, 'info');
|
|
409
510
|
stubInfo.restore();
|
|
410
|
-
assert.deepEqual(
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
511
|
+
assert.deepEqual(
|
|
512
|
+
res,
|
|
513
|
+
[
|
|
514
|
+
{
|
|
515
|
+
file: 'accounts.json',
|
|
516
|
+
schema: {
|
|
517
|
+
foo: 'foobar'
|
|
518
|
+
}
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
file: 'browserAction.json',
|
|
522
|
+
schema: {
|
|
523
|
+
bar: 'baz'
|
|
524
|
+
}
|
|
415
525
|
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
schema: {
|
|
420
|
-
bar: 'baz'
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
], 'result');
|
|
526
|
+
],
|
|
527
|
+
'result'
|
|
528
|
+
);
|
|
424
529
|
});
|
|
425
530
|
});
|
|
426
531
|
|
|
@@ -441,166 +546,212 @@ describe('create unified schema', () => {
|
|
|
441
546
|
|
|
442
547
|
it('should get object', async () => {
|
|
443
548
|
const stubInfo = sinon.stub(console, 'info');
|
|
444
|
-
const url = new URL('https://hg.mozilla.org');
|
|
549
|
+
const url = new URL('https://hg-edge.mozilla.org');
|
|
445
550
|
const mockPool = mockAgent.get(url.origin);
|
|
446
551
|
const basePath = '/releases/mozilla-beta/raw-file/tip/';
|
|
447
|
-
const browserUrl =
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
`${
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
552
|
+
const browserUrl = `${url.origin}${basePath}browser/components/extensions/schemas/`;
|
|
553
|
+
const toolkitUrl = `${url.origin}${basePath}toolkit/components/extensions/schemas/`;
|
|
554
|
+
mockPool
|
|
555
|
+
.intercept({ path: `${browserUrl}jar.mn`, method: 'GET' })
|
|
556
|
+
.reply(
|
|
557
|
+
200,
|
|
558
|
+
'content/extensions/schemas/foo.json\ncontent/extensions/schemas/bar.json\n'
|
|
559
|
+
);
|
|
560
|
+
mockPool
|
|
561
|
+
.intercept({ path: `${browserUrl}foo.json`, method: 'GET' })
|
|
454
562
|
.reply(200, '{ "foo": "Foo" }');
|
|
455
|
-
mockPool
|
|
563
|
+
mockPool
|
|
564
|
+
.intercept({ path: `${browserUrl}bar.json`, method: 'GET' })
|
|
456
565
|
.reply(200, '{ "bar": "Bar" }');
|
|
457
|
-
mockPool
|
|
458
|
-
.
|
|
459
|
-
|
|
566
|
+
mockPool
|
|
567
|
+
.intercept({ path: `${toolkitUrl}jar.mn`, method: 'GET' })
|
|
568
|
+
.reply(
|
|
569
|
+
200,
|
|
570
|
+
'content/extensions/schemas/baz.json\ncontent/extensions/schemas/qux.json\n'
|
|
571
|
+
);
|
|
572
|
+
mockPool
|
|
573
|
+
.intercept({ path: `${toolkitUrl}baz.json`, method: 'GET' })
|
|
460
574
|
.reply(200, '{ "baz": "Baz" }');
|
|
461
|
-
mockPool
|
|
575
|
+
mockPool
|
|
576
|
+
.intercept({ path: `${toolkitUrl}qux.json`, method: 'GET' })
|
|
462
577
|
.reply(200, '{ "qux": "Qux" }');
|
|
463
578
|
const res = await createUnifiedSchema();
|
|
464
579
|
assert.strictEqual(stubInfo.called, false, 'info');
|
|
465
580
|
stubInfo.restore();
|
|
466
|
-
assert.deepEqual(
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
581
|
+
assert.deepEqual(
|
|
582
|
+
res,
|
|
583
|
+
{
|
|
584
|
+
'foo.json': {
|
|
585
|
+
foo: 'Foo'
|
|
586
|
+
},
|
|
587
|
+
'bar.json': {
|
|
588
|
+
bar: 'Bar'
|
|
589
|
+
},
|
|
590
|
+
'baz.json': {
|
|
591
|
+
baz: 'Baz'
|
|
592
|
+
},
|
|
593
|
+
'qux.json': {
|
|
594
|
+
qux: 'Qux'
|
|
595
|
+
}
|
|
475
596
|
},
|
|
476
|
-
'
|
|
477
|
-
|
|
478
|
-
}
|
|
479
|
-
}, 'result');
|
|
597
|
+
'result'
|
|
598
|
+
);
|
|
480
599
|
});
|
|
481
600
|
|
|
482
601
|
it('should get object', async () => {
|
|
483
602
|
const stubInfo = sinon.stub(console, 'info');
|
|
484
|
-
const url = new URL('https://hg.mozilla.org');
|
|
603
|
+
const url = new URL('https://hg-edge.mozilla.org');
|
|
485
604
|
const mockPool = mockAgent.get(url.origin);
|
|
486
605
|
const basePath = '/mozilla-central/raw-file/tip/';
|
|
487
|
-
const browserUrl =
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
`${
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
606
|
+
const browserUrl = `${url.origin}${basePath}browser/components/extensions/schemas/`;
|
|
607
|
+
const toolkitUrl = `${url.origin}${basePath}toolkit/components/extensions/schemas/`;
|
|
608
|
+
mockPool
|
|
609
|
+
.intercept({ path: `${browserUrl}jar.mn`, method: 'GET' })
|
|
610
|
+
.reply(
|
|
611
|
+
200,
|
|
612
|
+
'content/extensions/schemas/foo.json\ncontent/extensions/schemas/bar.json\n'
|
|
613
|
+
);
|
|
614
|
+
mockPool
|
|
615
|
+
.intercept({ path: `${browserUrl}foo.json`, method: 'GET' })
|
|
494
616
|
.reply(200, '{ "foo": "Foo" }');
|
|
495
|
-
mockPool
|
|
617
|
+
mockPool
|
|
618
|
+
.intercept({ path: `${browserUrl}bar.json`, method: 'GET' })
|
|
496
619
|
.reply(200, '{ "bar": "Bar" }');
|
|
497
|
-
mockPool
|
|
498
|
-
.
|
|
499
|
-
|
|
620
|
+
mockPool
|
|
621
|
+
.intercept({ path: `${toolkitUrl}jar.mn`, method: 'GET' })
|
|
622
|
+
.reply(
|
|
623
|
+
200,
|
|
624
|
+
'content/extensions/schemas/baz.json\ncontent/extensions/schemas/qux.json\n'
|
|
625
|
+
);
|
|
626
|
+
mockPool
|
|
627
|
+
.intercept({ path: `${toolkitUrl}baz.json`, method: 'GET' })
|
|
500
628
|
.reply(200, '{ "baz": "Baz" }');
|
|
501
|
-
mockPool
|
|
629
|
+
mockPool
|
|
630
|
+
.intercept({ path: `${toolkitUrl}qux.json`, method: 'GET' })
|
|
502
631
|
.reply(200, '{ "qux": "Qux" }');
|
|
503
632
|
const res = await createUnifiedSchema('central', true);
|
|
504
633
|
assert.strictEqual(stubInfo.called, true, 'info');
|
|
505
634
|
stubInfo.restore();
|
|
506
|
-
assert.deepEqual(
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
635
|
+
assert.deepEqual(
|
|
636
|
+
res,
|
|
637
|
+
{
|
|
638
|
+
'foo.json': {
|
|
639
|
+
foo: 'Foo'
|
|
640
|
+
},
|
|
641
|
+
'bar.json': {
|
|
642
|
+
bar: 'Bar'
|
|
643
|
+
},
|
|
644
|
+
'baz.json': {
|
|
645
|
+
baz: 'Baz'
|
|
646
|
+
},
|
|
647
|
+
'qux.json': {
|
|
648
|
+
qux: 'Qux'
|
|
649
|
+
}
|
|
515
650
|
},
|
|
516
|
-
'
|
|
517
|
-
|
|
518
|
-
}
|
|
519
|
-
}, 'result');
|
|
651
|
+
'result'
|
|
652
|
+
);
|
|
520
653
|
});
|
|
521
654
|
|
|
522
655
|
it('should get object', async () => {
|
|
523
656
|
const stubInfo = sinon.stub(console, 'info');
|
|
524
|
-
const url = new URL('https://hg.mozilla.org');
|
|
657
|
+
const url = new URL('https://hg-edge.mozilla.org');
|
|
525
658
|
const mockPool = mockAgent.get(url.origin);
|
|
526
659
|
const basePath = '/mozilla-central/raw-file/tip/';
|
|
527
660
|
const mailBasePath = '/comm-central/raw-file/tip/';
|
|
528
|
-
const browserUrl =
|
|
529
|
-
|
|
530
|
-
const
|
|
531
|
-
`${url.origin}${basePath}toolkit/components/extensions/schemas/`;
|
|
532
|
-
const mailBaseUrl =
|
|
533
|
-
`${url.origin}${mailBasePath}mail/components/extensions/`;
|
|
661
|
+
const browserUrl = `${url.origin}${basePath}browser/components/extensions/schemas/`;
|
|
662
|
+
const toolkitUrl = `${url.origin}${basePath}toolkit/components/extensions/schemas/`;
|
|
663
|
+
const mailBaseUrl = `${url.origin}${mailBasePath}mail/components/extensions/`;
|
|
534
664
|
const mailUrl = `${mailBaseUrl}schemas/`;
|
|
535
|
-
mockPool
|
|
665
|
+
mockPool
|
|
666
|
+
.intercept({ path: `${browserUrl}commands.json`, method: 'GET' })
|
|
536
667
|
.reply(200, '{ "commands": "Commands" }');
|
|
537
|
-
mockPool
|
|
668
|
+
mockPool
|
|
669
|
+
.intercept({ path: `${browserUrl}pkcs11.json`, method: 'GET' })
|
|
538
670
|
.reply(200, '{ "pkcs11": "Pkcs11" }');
|
|
539
|
-
mockPool
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
671
|
+
mockPool
|
|
672
|
+
.intercept({
|
|
673
|
+
path: `${toolkitUrl}content_scripts.json`,
|
|
674
|
+
method: 'GET'
|
|
675
|
+
})
|
|
676
|
+
.reply(200, '{ "content_scripts": "ContentScripts" }');
|
|
677
|
+
mockPool
|
|
678
|
+
.intercept({ path: `${toolkitUrl}experiments.json`, method: 'GET' })
|
|
544
679
|
.reply(200, '{ "experiments": "Experiments" }');
|
|
545
|
-
mockPool
|
|
680
|
+
mockPool
|
|
681
|
+
.intercept({ path: `${toolkitUrl}extension.json`, method: 'GET' })
|
|
546
682
|
.reply(200, '{ "extension": "Extension" }');
|
|
547
|
-
mockPool
|
|
683
|
+
mockPool
|
|
684
|
+
.intercept({ path: `${toolkitUrl}i18n.json`, method: 'GET' })
|
|
548
685
|
.reply(200, '{ "i18n": "I18n" }');
|
|
549
|
-
mockPool
|
|
686
|
+
mockPool
|
|
687
|
+
.intercept({ path: `${toolkitUrl}management.json`, method: 'GET' })
|
|
550
688
|
.reply(200, '{ "management": "Management" }');
|
|
551
|
-
mockPool
|
|
689
|
+
mockPool
|
|
690
|
+
.intercept({ path: `${toolkitUrl}permissions.json`, method: 'GET' })
|
|
552
691
|
.reply(200, '{ "permissions": "Permissions" }');
|
|
553
|
-
mockPool
|
|
692
|
+
mockPool
|
|
693
|
+
.intercept({ path: `${toolkitUrl}runtime.json`, method: 'GET' })
|
|
554
694
|
.reply(200, '{ "runtime": "Runtime" }');
|
|
555
|
-
mockPool
|
|
695
|
+
mockPool
|
|
696
|
+
.intercept({ path: `${toolkitUrl}theme.json`, method: 'GET' })
|
|
556
697
|
.reply(200, '{ "theme": "Theme" }');
|
|
557
|
-
mockPool
|
|
558
|
-
.
|
|
559
|
-
|
|
698
|
+
mockPool
|
|
699
|
+
.intercept({ path: `${mailBaseUrl}jar.mn`, method: 'GET' })
|
|
700
|
+
.reply(
|
|
701
|
+
200,
|
|
702
|
+
'content/extensions/schemas/foo.json\ncontent/extensions/schemas/bar.json\n'
|
|
703
|
+
);
|
|
704
|
+
mockPool
|
|
705
|
+
.intercept({ path: `${mailUrl}foo.json`, method: 'GET' })
|
|
560
706
|
.reply(200, '{ "foo": "Foo" }');
|
|
561
|
-
mockPool
|
|
707
|
+
mockPool
|
|
708
|
+
.intercept({ path: `${mailUrl}bar.json`, method: 'GET' })
|
|
562
709
|
.reply(200, '{ "bar": "Bar" }');
|
|
563
710
|
const res = await createUnifiedSchema('mail', true);
|
|
564
711
|
assert.strictEqual(stubInfo.called, true, 'info');
|
|
565
712
|
stubInfo.restore();
|
|
566
|
-
assert.deepEqual(
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
713
|
+
assert.deepEqual(
|
|
714
|
+
res,
|
|
715
|
+
{
|
|
716
|
+
'commands.json': {
|
|
717
|
+
commands: 'Commands'
|
|
718
|
+
},
|
|
719
|
+
'pkcs11.json': {
|
|
720
|
+
pkcs11: 'Pkcs11'
|
|
721
|
+
},
|
|
722
|
+
'content_scripts.json': {
|
|
723
|
+
content_scripts: 'ContentScripts'
|
|
724
|
+
},
|
|
725
|
+
'experiments.json': {
|
|
726
|
+
experiments: 'Experiments'
|
|
727
|
+
},
|
|
728
|
+
'extension.json': {
|
|
729
|
+
extension: 'Extension'
|
|
730
|
+
},
|
|
731
|
+
'i18n.json': {
|
|
732
|
+
i18n: 'I18n'
|
|
733
|
+
},
|
|
734
|
+
'management.json': {
|
|
735
|
+
management: 'Management'
|
|
736
|
+
},
|
|
737
|
+
'permissions.json': {
|
|
738
|
+
permissions: 'Permissions'
|
|
739
|
+
},
|
|
740
|
+
'runtime.json': {
|
|
741
|
+
runtime: 'Runtime'
|
|
742
|
+
},
|
|
743
|
+
'theme.json': {
|
|
744
|
+
theme: 'Theme'
|
|
745
|
+
},
|
|
746
|
+
'foo.json': {
|
|
747
|
+
foo: 'Foo'
|
|
748
|
+
},
|
|
749
|
+
'bar.json': {
|
|
750
|
+
bar: 'Bar'
|
|
751
|
+
}
|
|
599
752
|
},
|
|
600
|
-
'
|
|
601
|
-
|
|
602
|
-
}
|
|
603
|
-
}, 'result');
|
|
753
|
+
'result'
|
|
754
|
+
);
|
|
604
755
|
});
|
|
605
756
|
});
|
|
606
757
|
|
|
@@ -621,48 +772,70 @@ describe('save schema file', () => {
|
|
|
621
772
|
|
|
622
773
|
it('should throw', async () => {
|
|
623
774
|
await saveSchemaFile().catch(e => {
|
|
624
|
-
assert.deepStrictEqual(
|
|
625
|
-
|
|
775
|
+
assert.deepStrictEqual(
|
|
776
|
+
e,
|
|
777
|
+
new TypeError('Expected String but got Undefined.')
|
|
778
|
+
);
|
|
626
779
|
});
|
|
627
780
|
});
|
|
628
781
|
|
|
629
782
|
it('should create file', async () => {
|
|
630
|
-
const url = new URL(
|
|
783
|
+
const url = new URL(
|
|
784
|
+
'https://hg-edge.mozilla.org/mozilla-central/raw-file/tip/'
|
|
785
|
+
);
|
|
631
786
|
const mockPool = mockAgent.get(url.origin);
|
|
632
|
-
const browserItems = [
|
|
633
|
-
'commands.json',
|
|
634
|
-
'pkcs11.json'
|
|
635
|
-
];
|
|
787
|
+
const browserItems = ['commands.json', 'pkcs11.json'];
|
|
636
788
|
for (const item of browserItems) {
|
|
637
|
-
mockPool
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
789
|
+
mockPool
|
|
790
|
+
.intercept({
|
|
791
|
+
path: `${url.pathname}browser/components/extensions/schemas/${item}`,
|
|
792
|
+
method: 'GET'
|
|
793
|
+
})
|
|
794
|
+
.reply(200, `{ "browser": "${item}" }`);
|
|
641
795
|
}
|
|
642
796
|
const toolkitItems = [
|
|
643
|
-
'content_scripts.json',
|
|
644
|
-
'
|
|
797
|
+
'content_scripts.json',
|
|
798
|
+
'experiments.json',
|
|
799
|
+
'extension.json',
|
|
800
|
+
'i18n.json',
|
|
801
|
+
'management.json',
|
|
802
|
+
'permissions.json',
|
|
803
|
+
'runtime.json',
|
|
804
|
+
'theme.json'
|
|
645
805
|
];
|
|
646
806
|
for (const item of toolkitItems) {
|
|
647
|
-
mockPool
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
807
|
+
mockPool
|
|
808
|
+
.intercept({
|
|
809
|
+
path: `${url.pathname}toolkit/components/extensions/schemas/${item}`,
|
|
810
|
+
method: 'GET'
|
|
811
|
+
})
|
|
812
|
+
.reply(200, `{ "toolkit": "${item}" }`);
|
|
651
813
|
}
|
|
652
|
-
mockPool
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
814
|
+
mockPool
|
|
815
|
+
.intercept({
|
|
816
|
+
path: '/comm-central/raw-file/tip/mail/components/extensions/jar.mn',
|
|
817
|
+
method: 'GET'
|
|
818
|
+
})
|
|
819
|
+
.reply(
|
|
820
|
+
200,
|
|
821
|
+
'# comment\n\nmessenger.jar:\n% content/messenger/ext-mail.json\n content/messenger/schemas/accounts.json\n'
|
|
822
|
+
);
|
|
823
|
+
mockPool
|
|
824
|
+
.intercept({
|
|
825
|
+
path: '/comm-central/raw-file/tip/mail/components/extensions/schemas/accounts.json',
|
|
826
|
+
method: 'GET'
|
|
827
|
+
})
|
|
828
|
+
.reply(200, '{ "mail": "accounts.json" }');
|
|
660
829
|
const stubWrite = sinon.stub(fs.promises, 'writeFile');
|
|
661
830
|
const stubInfo = sinon.stub(console, 'info');
|
|
662
831
|
const i = stubWrite.callCount;
|
|
663
832
|
const j = stubInfo.callCount;
|
|
664
|
-
const filePath =
|
|
665
|
-
|
|
833
|
+
const filePath = path.join(
|
|
834
|
+
process.cwd(),
|
|
835
|
+
'schemas',
|
|
836
|
+
'mail',
|
|
837
|
+
'mailext.json'
|
|
838
|
+
);
|
|
666
839
|
const res = await saveSchemaFile('mail');
|
|
667
840
|
const { callCount: writeCallCount } = stubWrite;
|
|
668
841
|
const { callCount: infoCallCount } = stubInfo;
|
|
@@ -674,42 +847,62 @@ describe('save schema file', () => {
|
|
|
674
847
|
});
|
|
675
848
|
|
|
676
849
|
it('should create file', async () => {
|
|
677
|
-
const url = new URL(
|
|
850
|
+
const url = new URL(
|
|
851
|
+
'https://hg-edge.mozilla.org/mozilla-central/raw-file/tip/'
|
|
852
|
+
);
|
|
678
853
|
const mockPool = mockAgent.get(url.origin);
|
|
679
|
-
const browserItems = [
|
|
680
|
-
'commands.json',
|
|
681
|
-
'pkcs11.json'
|
|
682
|
-
];
|
|
854
|
+
const browserItems = ['commands.json', 'pkcs11.json'];
|
|
683
855
|
for (const item of browserItems) {
|
|
684
|
-
mockPool
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
856
|
+
mockPool
|
|
857
|
+
.intercept({
|
|
858
|
+
path: `${url.pathname}browser/components/extensions/schemas/${item}`,
|
|
859
|
+
method: 'GET'
|
|
860
|
+
})
|
|
861
|
+
.reply(200, `{ "browser": "${item}" }`);
|
|
688
862
|
}
|
|
689
863
|
const toolkitItems = [
|
|
690
|
-
'content_scripts.json',
|
|
691
|
-
'
|
|
864
|
+
'content_scripts.json',
|
|
865
|
+
'experiments.json',
|
|
866
|
+
'extension.json',
|
|
867
|
+
'i18n.json',
|
|
868
|
+
'management.json',
|
|
869
|
+
'permissions.json',
|
|
870
|
+
'runtime.json',
|
|
871
|
+
'theme.json'
|
|
692
872
|
];
|
|
693
873
|
for (const item of toolkitItems) {
|
|
694
|
-
mockPool
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
874
|
+
mockPool
|
|
875
|
+
.intercept({
|
|
876
|
+
path: `${url.pathname}toolkit/components/extensions/schemas/${item}`,
|
|
877
|
+
method: 'GET'
|
|
878
|
+
})
|
|
879
|
+
.reply(200, `{ "toolkit": "${item}" }`);
|
|
698
880
|
}
|
|
699
|
-
mockPool
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
881
|
+
mockPool
|
|
882
|
+
.intercept({
|
|
883
|
+
path: '/comm-central/raw-file/tip/mail/components/extensions/jar.mn',
|
|
884
|
+
method: 'GET'
|
|
885
|
+
})
|
|
886
|
+
.reply(
|
|
887
|
+
200,
|
|
888
|
+
'# comment\n\nmessenger.jar:\n% content/messenger/ext-mail.json\n content/messenger/schemas/accounts.json\n'
|
|
889
|
+
);
|
|
890
|
+
mockPool
|
|
891
|
+
.intercept({
|
|
892
|
+
path: '/comm-central/raw-file/tip/mail/components/extensions/schemas/accounts.json',
|
|
893
|
+
method: 'GET'
|
|
894
|
+
})
|
|
895
|
+
.reply(200, '{ "mail": "accounts.json" }');
|
|
707
896
|
const stubWrite = sinon.stub(fs.promises, 'writeFile');
|
|
708
897
|
const stubInfo = sinon.stub(console, 'info');
|
|
709
898
|
const i = stubWrite.callCount;
|
|
710
899
|
const j = stubInfo.callCount;
|
|
711
|
-
const filePath =
|
|
712
|
-
|
|
900
|
+
const filePath = path.join(
|
|
901
|
+
process.cwd(),
|
|
902
|
+
'schemas',
|
|
903
|
+
'mail',
|
|
904
|
+
'mailext.json'
|
|
905
|
+
);
|
|
713
906
|
const res = await saveSchemaFile('mail', true);
|
|
714
907
|
const { callCount: writeCallCount } = stubWrite;
|
|
715
908
|
const { callCount: infoCallCount } = stubInfo;
|
|
@@ -721,39 +914,57 @@ describe('save schema file', () => {
|
|
|
721
914
|
});
|
|
722
915
|
|
|
723
916
|
it('should create file', async () => {
|
|
724
|
-
const url =
|
|
725
|
-
|
|
917
|
+
const url = new URL(
|
|
918
|
+
'https://hg-edge.mozilla.org/releases/mozilla-beta/raw-file/tip/'
|
|
919
|
+
);
|
|
726
920
|
const mockPool = mockAgent.get(url.origin);
|
|
727
|
-
mockPool
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
921
|
+
mockPool
|
|
922
|
+
.intercept({
|
|
923
|
+
path: `${url.pathname}browser/components/extensions/schemas/jar.mn`,
|
|
924
|
+
method: 'GET'
|
|
925
|
+
})
|
|
926
|
+
.reply(
|
|
927
|
+
200,
|
|
928
|
+
'content/extensions/schemas/foo.json\ncontent/extensions/schemas/bar.json\n'
|
|
929
|
+
);
|
|
930
|
+
mockPool
|
|
931
|
+
.intercept({
|
|
932
|
+
path: `${url.pathname}browser/components/extensions/schemas/foo.json`,
|
|
933
|
+
method: 'GET'
|
|
934
|
+
})
|
|
935
|
+
.reply(200, '{ "browser": "foo.json" }');
|
|
936
|
+
mockPool
|
|
937
|
+
.intercept({
|
|
938
|
+
path: `${url.pathname}browser/components/extensions/schemas/bar.json`,
|
|
939
|
+
method: 'GET'
|
|
940
|
+
})
|
|
941
|
+
.reply(200, '{ "browser": "bar.json" }');
|
|
942
|
+
mockPool
|
|
943
|
+
.intercept({
|
|
944
|
+
path: `${url.pathname}toolkit/components/extensions/schemas/jar.mn`,
|
|
945
|
+
method: 'GET'
|
|
946
|
+
})
|
|
947
|
+
.reply(
|
|
948
|
+
200,
|
|
949
|
+
'content/extensions/schemas/baz.json\ncontent/extensions/schemas/qux.json\n'
|
|
950
|
+
);
|
|
951
|
+
mockPool
|
|
952
|
+
.intercept({
|
|
953
|
+
path: `${url.pathname}toolkit/components/extensions/schemas/baz.json`,
|
|
954
|
+
method: 'GET'
|
|
955
|
+
})
|
|
956
|
+
.reply(200, '{ "toolkit": "baz.json" }');
|
|
957
|
+
mockPool
|
|
958
|
+
.intercept({
|
|
959
|
+
path: `${url.pathname}toolkit/components/extensions/schemas/qux.json`,
|
|
960
|
+
method: 'GET'
|
|
961
|
+
})
|
|
962
|
+
.reply(200, '{ "toolkit": "qux.json" }');
|
|
751
963
|
const stubWrite = sinon.stub(fs.promises, 'writeFile');
|
|
752
964
|
const stubInfo = sinon.stub(console, 'info');
|
|
753
965
|
const i = stubWrite.callCount;
|
|
754
966
|
const j = stubInfo.callCount;
|
|
755
|
-
const filePath =
|
|
756
|
-
path.join(process.cwd(), 'schemas', 'beta', 'webext.json');
|
|
967
|
+
const filePath = path.join(process.cwd(), 'schemas', 'beta', 'webext.json');
|
|
757
968
|
const res = await saveSchemaFile('beta');
|
|
758
969
|
const { callCount: writeCallCount } = stubWrite;
|
|
759
970
|
const { callCount: infoCallCount } = stubInfo;
|
|
@@ -765,39 +976,57 @@ describe('save schema file', () => {
|
|
|
765
976
|
});
|
|
766
977
|
|
|
767
978
|
it('should create file', async () => {
|
|
768
|
-
const url =
|
|
769
|
-
|
|
979
|
+
const url = new URL(
|
|
980
|
+
'https://hg-edge.mozilla.org/releases/mozilla-beta/raw-file/tip/'
|
|
981
|
+
);
|
|
770
982
|
const mockPool = mockAgent.get(url.origin);
|
|
771
|
-
mockPool
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
983
|
+
mockPool
|
|
984
|
+
.intercept({
|
|
985
|
+
path: `${url.pathname}browser/components/extensions/schemas/jar.mn`,
|
|
986
|
+
method: 'GET'
|
|
987
|
+
})
|
|
988
|
+
.reply(
|
|
989
|
+
200,
|
|
990
|
+
'content/extensions/schemas/foo.json\ncontent/extensions/schemas/bar.json\n'
|
|
991
|
+
);
|
|
992
|
+
mockPool
|
|
993
|
+
.intercept({
|
|
994
|
+
path: `${url.pathname}browser/components/extensions/schemas/foo.json`,
|
|
995
|
+
method: 'GET'
|
|
996
|
+
})
|
|
997
|
+
.reply(200, '{ "browser": "foo.json" }');
|
|
998
|
+
mockPool
|
|
999
|
+
.intercept({
|
|
1000
|
+
path: `${url.pathname}browser/components/extensions/schemas/bar.json`,
|
|
1001
|
+
method: 'GET'
|
|
1002
|
+
})
|
|
1003
|
+
.reply(200, '{ "browser": "bar.json" }');
|
|
1004
|
+
mockPool
|
|
1005
|
+
.intercept({
|
|
1006
|
+
path: `${url.pathname}toolkit/components/extensions/schemas/jar.mn`,
|
|
1007
|
+
method: 'GET'
|
|
1008
|
+
})
|
|
1009
|
+
.reply(
|
|
1010
|
+
200,
|
|
1011
|
+
'content/extensions/schemas/baz.json\ncontent/extensions/schemas/qux.json\n'
|
|
1012
|
+
);
|
|
1013
|
+
mockPool
|
|
1014
|
+
.intercept({
|
|
1015
|
+
path: `${url.pathname}toolkit/components/extensions/schemas/baz.json`,
|
|
1016
|
+
method: 'GET'
|
|
1017
|
+
})
|
|
1018
|
+
.reply(200, '{ "toolkit": "baz.json" }');
|
|
1019
|
+
mockPool
|
|
1020
|
+
.intercept({
|
|
1021
|
+
path: `${url.pathname}toolkit/components/extensions/schemas/qux.json`,
|
|
1022
|
+
method: 'GET'
|
|
1023
|
+
})
|
|
1024
|
+
.reply(200, '{ "toolkit": "qux.json" }');
|
|
795
1025
|
const stubWrite = sinon.stub(fs.promises, 'writeFile');
|
|
796
1026
|
const stubInfo = sinon.stub(console, 'info');
|
|
797
1027
|
const i = stubWrite.callCount;
|
|
798
1028
|
const j = stubInfo.callCount;
|
|
799
|
-
const filePath =
|
|
800
|
-
path.join(process.cwd(), 'schemas', 'beta', 'webext.json');
|
|
1029
|
+
const filePath = path.join(process.cwd(), 'schemas', 'beta', 'webext.json');
|
|
801
1030
|
const res = await saveSchemaFile('beta', true);
|
|
802
1031
|
const { callCount: writeCallCount } = stubWrite;
|
|
803
1032
|
const { callCount: infoCallCount } = stubInfo;
|
|
@@ -825,65 +1054,96 @@ describe('update schemas files', () => {
|
|
|
825
1054
|
});
|
|
826
1055
|
|
|
827
1056
|
it('should not call function', async () => {
|
|
828
|
-
const url = new URL(
|
|
1057
|
+
const url = new URL(
|
|
1058
|
+
'https://hg-edge.mozilla.org/mozilla-central/raw-file/tip/'
|
|
1059
|
+
);
|
|
829
1060
|
const centralPath = url.pathname;
|
|
830
1061
|
const betaPath = '/releases/mozilla-beta/raw-file/tip/';
|
|
831
1062
|
const mailPath = '/comm-central/raw-file/tip/';
|
|
832
1063
|
const mockPool = mockAgent.get(url.origin);
|
|
833
1064
|
for (const item of [centralPath, betaPath]) {
|
|
834
|
-
mockPool
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
1065
|
+
mockPool
|
|
1066
|
+
.intercept({
|
|
1067
|
+
path: `${item}browser/components/extensions/schemas/jar.mn`,
|
|
1068
|
+
method: 'GET'
|
|
1069
|
+
})
|
|
1070
|
+
.reply(
|
|
1071
|
+
200,
|
|
1072
|
+
'content/extensions/schemas/foo.json\ncontent/extensions/schemas/bar.json\n'
|
|
1073
|
+
);
|
|
1074
|
+
mockPool
|
|
1075
|
+
.intercept({
|
|
1076
|
+
path: `${item}browser/components/extensions/schemas/foo.json`,
|
|
1077
|
+
method: 'GET'
|
|
1078
|
+
})
|
|
1079
|
+
.reply(200, '{ "browser": "foo.json" }');
|
|
1080
|
+
mockPool
|
|
1081
|
+
.intercept({
|
|
1082
|
+
path: `${item}browser/components/extensions/schemas/bar.json`,
|
|
1083
|
+
method: 'GET'
|
|
1084
|
+
})
|
|
1085
|
+
.reply(200, '{ "browser": "bar.json" }');
|
|
1086
|
+
mockPool
|
|
1087
|
+
.intercept({
|
|
1088
|
+
path: `${item}toolkit/components/extensions/schemas/jar.mn`,
|
|
1089
|
+
method: 'GET'
|
|
1090
|
+
})
|
|
1091
|
+
.reply(
|
|
1092
|
+
200,
|
|
1093
|
+
'content/extensions/schemas/baz.json\ncontent/extensions/schemas/qux.json\n'
|
|
1094
|
+
);
|
|
1095
|
+
mockPool
|
|
1096
|
+
.intercept({
|
|
1097
|
+
path: `${item}toolkit/components/extensions/schemas/baz.json`,
|
|
1098
|
+
method: 'GET'
|
|
1099
|
+
})
|
|
1100
|
+
.reply(200, '{ "toolkit": "baz.json" }');
|
|
1101
|
+
mockPool
|
|
1102
|
+
.intercept({
|
|
1103
|
+
path: `${item}toolkit/components/extensions/schemas/qux.json`,
|
|
1104
|
+
method: 'GET'
|
|
1105
|
+
})
|
|
1106
|
+
.reply(200, '{ "toolkit": "qux.json" }');
|
|
858
1107
|
}
|
|
859
|
-
const browserItems = [
|
|
860
|
-
'commands.json',
|
|
861
|
-
'pkcs11.json'
|
|
862
|
-
];
|
|
1108
|
+
const browserItems = ['commands.json', 'pkcs11.json'];
|
|
863
1109
|
for (const item of browserItems) {
|
|
864
|
-
mockPool
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
1110
|
+
mockPool
|
|
1111
|
+
.intercept({
|
|
1112
|
+
path: `${centralPath}browser/components/extensions/schemas/${item}`,
|
|
1113
|
+
method: 'GET'
|
|
1114
|
+
})
|
|
1115
|
+
.reply(200, `{ "browser": "${item}" }`);
|
|
868
1116
|
}
|
|
869
1117
|
const toolkitItems = [
|
|
870
|
-
'content_scripts.json',
|
|
871
|
-
'
|
|
1118
|
+
'content_scripts.json',
|
|
1119
|
+
'experiments.json',
|
|
1120
|
+
'extension.json',
|
|
1121
|
+
'i18n.json',
|
|
1122
|
+
'management.json',
|
|
1123
|
+
'permissions.json',
|
|
1124
|
+
'runtime.json',
|
|
1125
|
+
'theme.json'
|
|
872
1126
|
];
|
|
873
1127
|
for (const item of toolkitItems) {
|
|
874
|
-
mockPool
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
1128
|
+
mockPool
|
|
1129
|
+
.intercept({
|
|
1130
|
+
path: `${centralPath}toolkit/components/extensions/schemas/${item}`,
|
|
1131
|
+
method: 'GET'
|
|
1132
|
+
})
|
|
1133
|
+
.reply(200, `{ "toolkit": "${item}" }`);
|
|
878
1134
|
}
|
|
879
|
-
mockPool
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
1135
|
+
mockPool
|
|
1136
|
+
.intercept({
|
|
1137
|
+
path: `${mailPath}mail/components/extensions/jar.mn`,
|
|
1138
|
+
method: 'GET'
|
|
1139
|
+
})
|
|
1140
|
+
.reply(200, 'content/messenger/schemas/quux.json\n');
|
|
1141
|
+
mockPool
|
|
1142
|
+
.intercept({
|
|
1143
|
+
path: `${mailPath}mail/components/extensions/schemas/quux.json`,
|
|
1144
|
+
method: 'GET'
|
|
1145
|
+
})
|
|
1146
|
+
.reply(200, '{ "mail": "quux.json" }');
|
|
887
1147
|
const stubWrite = sinon.stub(fs.promises, 'writeFile');
|
|
888
1148
|
const stubTrace = sinon.stub(console, 'trace');
|
|
889
1149
|
const i = stubTrace.callCount;
|
|
@@ -897,65 +1157,96 @@ describe('update schemas files', () => {
|
|
|
897
1157
|
});
|
|
898
1158
|
|
|
899
1159
|
it('should not call function', async () => {
|
|
900
|
-
const url = new URL(
|
|
1160
|
+
const url = new URL(
|
|
1161
|
+
'https://hg-edge.mozilla.org/mozilla-central/raw-file/tip/'
|
|
1162
|
+
);
|
|
901
1163
|
const centralPath = url.pathname;
|
|
902
1164
|
const betaPath = '/releases/mozilla-beta/raw-file/tip/';
|
|
903
1165
|
const mailPath = '/comm-central/raw-file/tip/';
|
|
904
1166
|
const mockPool = mockAgent.get(url.origin);
|
|
905
1167
|
for (const item of [centralPath, betaPath]) {
|
|
906
|
-
mockPool
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
1168
|
+
mockPool
|
|
1169
|
+
.intercept({
|
|
1170
|
+
path: `${item}browser/components/extensions/schemas/jar.mn`,
|
|
1171
|
+
method: 'GET'
|
|
1172
|
+
})
|
|
1173
|
+
.reply(
|
|
1174
|
+
200,
|
|
1175
|
+
'content/extensions/schemas/foo.json\ncontent/extensions/schemas/bar.json\n'
|
|
1176
|
+
);
|
|
1177
|
+
mockPool
|
|
1178
|
+
.intercept({
|
|
1179
|
+
path: `${item}browser/components/extensions/schemas/foo.json`,
|
|
1180
|
+
method: 'GET'
|
|
1181
|
+
})
|
|
1182
|
+
.reply(200, '{ "browser": "foo.json" }');
|
|
1183
|
+
mockPool
|
|
1184
|
+
.intercept({
|
|
1185
|
+
path: `${item}browser/components/extensions/schemas/bar.json`,
|
|
1186
|
+
method: 'GET'
|
|
1187
|
+
})
|
|
1188
|
+
.reply(200, '{ "browser": "bar.json" }');
|
|
1189
|
+
mockPool
|
|
1190
|
+
.intercept({
|
|
1191
|
+
path: `${item}toolkit/components/extensions/schemas/jar.mn`,
|
|
1192
|
+
method: 'GET'
|
|
1193
|
+
})
|
|
1194
|
+
.reply(
|
|
1195
|
+
200,
|
|
1196
|
+
'content/extensions/schemas/baz.json\ncontent/extensions/schemas/qux.json\n'
|
|
1197
|
+
);
|
|
1198
|
+
mockPool
|
|
1199
|
+
.intercept({
|
|
1200
|
+
path: `${item}toolkit/components/extensions/schemas/baz.json`,
|
|
1201
|
+
method: 'GET'
|
|
1202
|
+
})
|
|
1203
|
+
.reply(200, '{ "toolkit": "baz.json" }');
|
|
1204
|
+
mockPool
|
|
1205
|
+
.intercept({
|
|
1206
|
+
path: `${item}toolkit/components/extensions/schemas/qux.json`,
|
|
1207
|
+
method: 'GET'
|
|
1208
|
+
})
|
|
1209
|
+
.reply(200, '{ "toolkit": "qux.json" }');
|
|
930
1210
|
}
|
|
931
|
-
const browserItems = [
|
|
932
|
-
'commands.json',
|
|
933
|
-
'pkcs11.json'
|
|
934
|
-
];
|
|
1211
|
+
const browserItems = ['commands.json', 'pkcs11.json'];
|
|
935
1212
|
for (const item of browserItems) {
|
|
936
|
-
mockPool
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
1213
|
+
mockPool
|
|
1214
|
+
.intercept({
|
|
1215
|
+
path: `${centralPath}browser/components/extensions/schemas/${item}`,
|
|
1216
|
+
method: 'GET'
|
|
1217
|
+
})
|
|
1218
|
+
.reply(200, `{ "browser": "${item}" }`);
|
|
940
1219
|
}
|
|
941
1220
|
const toolkitItems = [
|
|
942
|
-
'content_scripts.json',
|
|
943
|
-
'
|
|
1221
|
+
'content_scripts.json',
|
|
1222
|
+
'experiments.json',
|
|
1223
|
+
'extension.json',
|
|
1224
|
+
'i18n.json',
|
|
1225
|
+
'management.json',
|
|
1226
|
+
'permissions.json',
|
|
1227
|
+
'runtime.json',
|
|
1228
|
+
'theme.json'
|
|
944
1229
|
];
|
|
945
1230
|
for (const item of toolkitItems) {
|
|
946
|
-
mockPool
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
1231
|
+
mockPool
|
|
1232
|
+
.intercept({
|
|
1233
|
+
path: `${centralPath}toolkit/components/extensions/schemas/${item}`,
|
|
1234
|
+
method: 'GET'
|
|
1235
|
+
})
|
|
1236
|
+
.reply(200, `{ "toolkit": "${item}" }`);
|
|
950
1237
|
}
|
|
951
|
-
mockPool
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
1238
|
+
mockPool
|
|
1239
|
+
.intercept({
|
|
1240
|
+
path: `${mailPath}mail/components/extensions/jar.mn`,
|
|
1241
|
+
method: 'GET'
|
|
1242
|
+
})
|
|
1243
|
+
.reply(200, 'content/messenger/schemas/quux.json\n');
|
|
1244
|
+
mockPool
|
|
1245
|
+
.intercept({
|
|
1246
|
+
path: `${mailPath}mail/components/extensions/schemas/quux.json`,
|
|
1247
|
+
method: 'GET'
|
|
1248
|
+
})
|
|
1249
|
+
.reply(400, '{ "ok": false, "status": 400 }');
|
|
959
1250
|
const stubWrite = sinon.stub(fs.promises, 'writeFile');
|
|
960
1251
|
const stubTrace = sinon.stub(console, 'trace');
|
|
961
1252
|
const i = stubTrace.callCount;
|
|
@@ -969,33 +1260,52 @@ describe('update schemas files', () => {
|
|
|
969
1260
|
});
|
|
970
1261
|
|
|
971
1262
|
it('should not call function', async () => {
|
|
972
|
-
const url =
|
|
973
|
-
|
|
1263
|
+
const url = new URL(
|
|
1264
|
+
'https://hg-edge.mozilla.org/releases/mozilla-beta/raw-file/tip/'
|
|
1265
|
+
);
|
|
974
1266
|
const mockPool = mockAgent.get(url.origin);
|
|
975
|
-
mockPool
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
1267
|
+
mockPool
|
|
1268
|
+
.intercept({
|
|
1269
|
+
path: `${url.pathname}browser/components/extensions/schemas/jar.mn`,
|
|
1270
|
+
method: 'GET'
|
|
1271
|
+
})
|
|
1272
|
+
.reply(
|
|
1273
|
+
200,
|
|
1274
|
+
'content/extensions/schemas/foo.json\ncontent/extensions/schemas/bar.json\n'
|
|
1275
|
+
);
|
|
1276
|
+
mockPool
|
|
1277
|
+
.intercept({
|
|
1278
|
+
path: `${url.pathname}browser/components/extensions/schemas/foo.json`,
|
|
1279
|
+
method: 'GET'
|
|
1280
|
+
})
|
|
1281
|
+
.reply(200, '{ "browser": "foo.json" }');
|
|
1282
|
+
mockPool
|
|
1283
|
+
.intercept({
|
|
1284
|
+
path: `${url.pathname}browser/components/extensions/schemas/bar.json`,
|
|
1285
|
+
method: 'GET'
|
|
1286
|
+
})
|
|
1287
|
+
.reply(200, '{ "browser": "bar.json" }');
|
|
1288
|
+
mockPool
|
|
1289
|
+
.intercept({
|
|
1290
|
+
path: `${url.pathname}toolkit/components/extensions/schemas/jar.mn`,
|
|
1291
|
+
method: 'GET'
|
|
1292
|
+
})
|
|
1293
|
+
.reply(
|
|
1294
|
+
200,
|
|
1295
|
+
'content/extensions/schemas/baz.json\ncontent/extensions/schemas/qux.json\n'
|
|
1296
|
+
);
|
|
1297
|
+
mockPool
|
|
1298
|
+
.intercept({
|
|
1299
|
+
path: `${url.pathname}toolkit/components/extensions/schemas/baz.json`,
|
|
1300
|
+
method: 'GET'
|
|
1301
|
+
})
|
|
1302
|
+
.reply(200, '{ "toolkit": "baz.json" }');
|
|
1303
|
+
mockPool
|
|
1304
|
+
.intercept({
|
|
1305
|
+
path: `${url.pathname}toolkit/components/extensions/schemas/qux.json`,
|
|
1306
|
+
method: 'GET'
|
|
1307
|
+
})
|
|
1308
|
+
.reply(200, '{ "toolkit": "qux.json" }');
|
|
999
1309
|
const stubWrite = sinon.stub(fs.promises, 'writeFile');
|
|
1000
1310
|
const stubTrace = sinon.stub(console, 'trace');
|
|
1001
1311
|
const i = stubTrace.callCount;
|
|
@@ -1011,33 +1321,52 @@ describe('update schemas files', () => {
|
|
|
1011
1321
|
});
|
|
1012
1322
|
|
|
1013
1323
|
it('should not call function', async () => {
|
|
1014
|
-
const url =
|
|
1015
|
-
|
|
1324
|
+
const url = new URL(
|
|
1325
|
+
'https://hg-edge.mozilla.org/releases/mozilla-beta/raw-file/tip/'
|
|
1326
|
+
);
|
|
1016
1327
|
const mockPool = mockAgent.get(url.origin);
|
|
1017
|
-
mockPool
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1328
|
+
mockPool
|
|
1329
|
+
.intercept({
|
|
1330
|
+
path: `${url.pathname}browser/components/extensions/schemas/jar.mn`,
|
|
1331
|
+
method: 'GET'
|
|
1332
|
+
})
|
|
1333
|
+
.reply(
|
|
1334
|
+
200,
|
|
1335
|
+
'content/extensions/schemas/foo.json\ncontent/extensions/schemas/bar.json\n'
|
|
1336
|
+
);
|
|
1337
|
+
mockPool
|
|
1338
|
+
.intercept({
|
|
1339
|
+
path: `${url.pathname}browser/components/extensions/schemas/foo.json`,
|
|
1340
|
+
method: 'GET'
|
|
1341
|
+
})
|
|
1342
|
+
.reply(200, '{ "browser": "foo.json" }');
|
|
1343
|
+
mockPool
|
|
1344
|
+
.intercept({
|
|
1345
|
+
path: `${url.pathname}browser/components/extensions/schemas/bar.json`,
|
|
1346
|
+
method: 'GET'
|
|
1347
|
+
})
|
|
1348
|
+
.reply(200, '{ "browser": "bar.json" }');
|
|
1349
|
+
mockPool
|
|
1350
|
+
.intercept({
|
|
1351
|
+
path: `${url.pathname}toolkit/components/extensions/schemas/jar.mn`,
|
|
1352
|
+
method: 'GET'
|
|
1353
|
+
})
|
|
1354
|
+
.reply(
|
|
1355
|
+
200,
|
|
1356
|
+
'content/extensions/schemas/baz.json\ncontent/extensions/schemas/qux.json\n'
|
|
1357
|
+
);
|
|
1358
|
+
mockPool
|
|
1359
|
+
.intercept({
|
|
1360
|
+
path: `${url.pathname}toolkit/components/extensions/schemas/baz.json`,
|
|
1361
|
+
method: 'GET'
|
|
1362
|
+
})
|
|
1363
|
+
.reply(200, '{ "toolkit": "baz.json" }');
|
|
1364
|
+
mockPool
|
|
1365
|
+
.intercept({
|
|
1366
|
+
path: `${url.pathname}toolkit/components/extensions/schemas/qux.json`,
|
|
1367
|
+
method: 'GET'
|
|
1368
|
+
})
|
|
1369
|
+
.reply(400, '{ "ok": false, "status": 400 }');
|
|
1041
1370
|
const stubWrite = sinon.stub(fs.promises, 'writeFile');
|
|
1042
1371
|
const stubTrace = sinon.stub(console, 'trace');
|
|
1043
1372
|
const i = stubTrace.callCount;
|