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.
@@ -14,8 +14,15 @@ import {
14
14
 
15
15
  /* test */
16
16
  import {
17
- createUnifiedSchema, fetchText, getAllSchemaData, getChannelUrl, getFileList,
18
- getListedSchemaData, getMailExtSchemaData, getSchemaData, saveSchemaFile,
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(e,
40
- new TypeError('Expected String but got Undefined.'));
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.get(url.origin).intercept({ path: url.pathname, method: 'GET' })
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(e,
53
- new Error('Network response was not ok. status: 404'));
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.get(url.origin).intercept({ path: url.pathname, method: 'GET' })
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, 'https://hg.mozilla.org/releases/mozilla-beta/raw-file/tip/',
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, 'https://hg.mozilla.org/releases/mozilla-beta/raw-file/tip/',
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, 'https://hg.mozilla.org/mozilla-central/raw-file/tip/',
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, 'https://hg.mozilla.org/comm-central/raw-file/tip/',
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(e,
118
- new TypeError('Expected String but got Undefined.'));
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(e,
125
- new TypeError('Expected String but got Undefined.'));
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.get(url.origin).intercept({ path: url.pathname, method: 'GET' })
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(res, {
135
- file: 'foo.json',
136
- schema: {
137
- foo: ['bar']
138
- }
139
- }, 'result');
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(e,
161
- new TypeError('Expected String but got Undefined.'));
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.get(url.origin).intercept({ path: url.pathname, method: 'GET' })
168
- .reply(200, '# 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');
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(res, [
171
- 'alarms.json',
172
- 'browser_settings.json',
173
- 'geckoProfiler.json',
174
- 'i18n.json'
175
- ], 'result');
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(e,
197
- new TypeError('Expected String but got Undefined.'));
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.intercept({ path: '/jar.mn', method: 'GET' })
206
- .reply(200, 'content/extensions/schemas/foo.json\ncontent/extensions/schemas/bar.json\n');
207
- mockPool.intercept({ path: '/foo.json', method: 'GET' })
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.intercept({ path: '/bar.json', method: 'GET' })
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(res, [
215
- {
216
- file: 'foo.json',
217
- schema: {
218
- foo: 'foobar'
219
- }
220
- },
221
- {
222
- file: 'bar.json',
223
- schema: {
224
- baz: 'qux'
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
- ], 'result');
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.intercept({ path: '/jar.mn', method: 'GET' })
235
- .reply(200, 'content/extensions/schemas/foo.json\ncontent/extensions/schemas/bar.json\n');
236
- mockPool.intercept({ path: '/foo.json', method: 'GET' })
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.intercept({ path: '/bar.json', method: 'GET' })
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(res, [
244
- {
245
- file: 'foo.json',
246
- schema: {
247
- foo: 'foobar'
248
- }
249
- },
250
- {
251
- file: 'bar.json',
252
- schema: {
253
- baz: 'qux'
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
- ], 'result');
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(e,
278
- new TypeError('Expected String but got Undefined.'));
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(e,
285
- new TypeError('Expected Array but got Undefined.'));
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.intercept({ path: '/foo.json', method: 'GET' })
359
+ mockPool
360
+ .intercept({ path: '/foo.json', method: 'GET' })
294
361
  .reply(200, '{ "foo": "foobar" }');
295
- mockPool.intercept({ path: '/bar.json', method: 'GET' })
362
+ mockPool
363
+ .intercept({ path: '/bar.json', method: 'GET' })
296
364
  .reply(200, '{ "baz": "qux" }');
297
- const res = await getListedSchemaData('https://example.com/',
298
- ['foo.json', 'bar.json']);
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(res, [
302
- {
303
- file: 'foo.json',
304
- schema: {
305
- foo: 'foobar'
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
- file: 'bar.json',
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.intercept({ path: '/foo.json', method: 'GET' })
395
+ mockPool
396
+ .intercept({ path: '/foo.json', method: 'GET' })
322
397
  .reply(200, '{ "foo": "foobar" }');
323
- mockPool.intercept({ path: '/bar.json', method: 'GET' })
398
+ mockPool
399
+ .intercept({ path: '/bar.json', method: 'GET' })
324
400
  .reply(200, '{ "baz": "qux" }');
325
- const res = await getListedSchemaData('https://example.com/',
326
- ['foo.json', 'bar.json'], true);
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(res, [
330
- {
331
- file: 'foo.json',
332
- schema: {
333
- foo: 'foobar'
334
- }
335
- },
336
- {
337
- file: 'bar.json',
338
- schema: {
339
- baz: 'qux'
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
- ], 'result');
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(e,
364
- new TypeError('Expected String but got Undefined.'));
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.intercept({ path: '/jar.mn', method: 'GET' })
373
- .reply(200, '# 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');
374
- mockPool.intercept({ path: '/schemas/accounts.json', method: 'GET' })
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.intercept({ path: '/schemas/browserAction.json', method: 'GET' })
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(res, [
382
- {
383
- file: 'accounts.json',
384
- schema: {
385
- foo: 'foobar'
386
- }
387
- },
388
- {
389
- file: 'browserAction.json',
390
- schema: {
391
- bar: 'baz'
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
- ], 'result');
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.intercept({ path: '/jar.mn', method: 'GET' })
402
- .reply(200, '# 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');
403
- mockPool.intercept({ path: '/schemas/accounts.json', method: 'GET' })
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.intercept({ path: '/schemas/browserAction.json', method: 'GET' })
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(res, [
411
- {
412
- file: 'accounts.json',
413
- schema: {
414
- foo: 'foobar'
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
- file: 'browserAction.json',
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
- `${url.origin}${basePath}browser/components/extensions/schemas/`;
449
- const toolkitUrl =
450
- `${url.origin}${basePath}toolkit/components/extensions/schemas/`;
451
- mockPool.intercept({ path: `${browserUrl}jar.mn`, method: 'GET' })
452
- .reply(200, 'content/extensions/schemas/foo.json\ncontent/extensions/schemas/bar.json\n');
453
- mockPool.intercept({ path: `${browserUrl}foo.json`, method: 'GET' })
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.intercept({ path: `${browserUrl}bar.json`, method: 'GET' })
563
+ mockPool
564
+ .intercept({ path: `${browserUrl}bar.json`, method: 'GET' })
456
565
  .reply(200, '{ "bar": "Bar" }');
457
- mockPool.intercept({ path: `${toolkitUrl}jar.mn`, method: 'GET' })
458
- .reply(200, 'content/extensions/schemas/baz.json\ncontent/extensions/schemas/qux.json\n');
459
- mockPool.intercept({ path: `${toolkitUrl}baz.json`, method: 'GET' })
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.intercept({ path: `${toolkitUrl}qux.json`, method: 'GET' })
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(res, {
467
- 'foo.json': {
468
- foo: 'Foo'
469
- },
470
- 'bar.json': {
471
- bar: 'Bar'
472
- },
473
- 'baz.json': {
474
- baz: 'Baz'
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
- 'qux.json': {
477
- qux: 'Qux'
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
- `${url.origin}${basePath}browser/components/extensions/schemas/`;
489
- const toolkitUrl =
490
- `${url.origin}${basePath}toolkit/components/extensions/schemas/`;
491
- mockPool.intercept({ path: `${browserUrl}jar.mn`, method: 'GET' })
492
- .reply(200, 'content/extensions/schemas/foo.json\ncontent/extensions/schemas/bar.json\n');
493
- mockPool.intercept({ path: `${browserUrl}foo.json`, method: 'GET' })
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.intercept({ path: `${browserUrl}bar.json`, method: 'GET' })
617
+ mockPool
618
+ .intercept({ path: `${browserUrl}bar.json`, method: 'GET' })
496
619
  .reply(200, '{ "bar": "Bar" }');
497
- mockPool.intercept({ path: `${toolkitUrl}jar.mn`, method: 'GET' })
498
- .reply(200, 'content/extensions/schemas/baz.json\ncontent/extensions/schemas/qux.json\n');
499
- mockPool.intercept({ path: `${toolkitUrl}baz.json`, method: 'GET' })
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.intercept({ path: `${toolkitUrl}qux.json`, method: 'GET' })
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(res, {
507
- 'foo.json': {
508
- foo: 'Foo'
509
- },
510
- 'bar.json': {
511
- bar: 'Bar'
512
- },
513
- 'baz.json': {
514
- baz: 'Baz'
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
- 'qux.json': {
517
- qux: 'Qux'
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
- `${url.origin}${basePath}browser/components/extensions/schemas/`;
530
- const toolkitUrl =
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.intercept({ path: `${browserUrl}commands.json`, method: 'GET' })
665
+ mockPool
666
+ .intercept({ path: `${browserUrl}commands.json`, method: 'GET' })
536
667
  .reply(200, '{ "commands": "Commands" }');
537
- mockPool.intercept({ path: `${browserUrl}pkcs11.json`, method: 'GET' })
668
+ mockPool
669
+ .intercept({ path: `${browserUrl}pkcs11.json`, method: 'GET' })
538
670
  .reply(200, '{ "pkcs11": "Pkcs11" }');
539
- mockPool.intercept({
540
- path: `${toolkitUrl}content_scripts.json`,
541
- method: 'GET'
542
- }).reply(200, '{ "content_scripts": "ContentScripts" }');
543
- mockPool.intercept({ path: `${toolkitUrl}experiments.json`, method: 'GET' })
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.intercept({ path: `${toolkitUrl}extension.json`, method: 'GET' })
680
+ mockPool
681
+ .intercept({ path: `${toolkitUrl}extension.json`, method: 'GET' })
546
682
  .reply(200, '{ "extension": "Extension" }');
547
- mockPool.intercept({ path: `${toolkitUrl}i18n.json`, method: 'GET' })
683
+ mockPool
684
+ .intercept({ path: `${toolkitUrl}i18n.json`, method: 'GET' })
548
685
  .reply(200, '{ "i18n": "I18n" }');
549
- mockPool.intercept({ path: `${toolkitUrl}management.json`, method: 'GET' })
686
+ mockPool
687
+ .intercept({ path: `${toolkitUrl}management.json`, method: 'GET' })
550
688
  .reply(200, '{ "management": "Management" }');
551
- mockPool.intercept({ path: `${toolkitUrl}permissions.json`, method: 'GET' })
689
+ mockPool
690
+ .intercept({ path: `${toolkitUrl}permissions.json`, method: 'GET' })
552
691
  .reply(200, '{ "permissions": "Permissions" }');
553
- mockPool.intercept({ path: `${toolkitUrl}runtime.json`, method: 'GET' })
692
+ mockPool
693
+ .intercept({ path: `${toolkitUrl}runtime.json`, method: 'GET' })
554
694
  .reply(200, '{ "runtime": "Runtime" }');
555
- mockPool.intercept({ path: `${toolkitUrl}theme.json`, method: 'GET' })
695
+ mockPool
696
+ .intercept({ path: `${toolkitUrl}theme.json`, method: 'GET' })
556
697
  .reply(200, '{ "theme": "Theme" }');
557
- mockPool.intercept({ path: `${mailBaseUrl}jar.mn`, method: 'GET' })
558
- .reply(200, 'content/extensions/schemas/foo.json\ncontent/extensions/schemas/bar.json\n');
559
- mockPool.intercept({ path: `${mailUrl}foo.json`, method: 'GET' })
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.intercept({ path: `${mailUrl}bar.json`, method: 'GET' })
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(res, {
567
- 'commands.json': {
568
- commands: 'Commands'
569
- },
570
- 'pkcs11.json': {
571
- pkcs11: 'Pkcs11'
572
- },
573
- 'content_scripts.json': {
574
- content_scripts: 'ContentScripts'
575
- },
576
- 'experiments.json': {
577
- experiments: 'Experiments'
578
- },
579
- 'extension.json': {
580
- extension: 'Extension'
581
- },
582
- 'i18n.json': {
583
- i18n: 'I18n'
584
- },
585
- 'management.json': {
586
- management: 'Management'
587
- },
588
- 'permissions.json': {
589
- permissions: 'Permissions'
590
- },
591
- 'runtime.json': {
592
- runtime: 'Runtime'
593
- },
594
- 'theme.json': {
595
- theme: 'Theme'
596
- },
597
- 'foo.json': {
598
- foo: 'Foo'
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
- 'bar.json': {
601
- bar: 'Bar'
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(e,
625
- new TypeError('Expected String but got Undefined.'));
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('https://hg.mozilla.org/mozilla-central/raw-file/tip/');
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.intercept({
638
- path: `${url.pathname}browser/components/extensions/schemas/${item}`,
639
- method: 'GET'
640
- }).reply(200, `{ "browser": "${item}" }`);
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', 'experiments.json', 'extension.json', 'i18n.json',
644
- 'management.json', 'permissions.json', 'runtime.json', 'theme.json'
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.intercept({
648
- path: `${url.pathname}toolkit/components/extensions/schemas/${item}`,
649
- method: 'GET'
650
- }).reply(200, `{ "toolkit": "${item}" }`);
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.intercept({
653
- path: '/comm-central/raw-file/tip/mail/components/extensions/jar.mn',
654
- method: 'GET'
655
- }).reply(200, '# comment\n\nmessenger.jar:\n% content/messenger/ext-mail.json\n content/messenger/schemas/accounts.json\n');
656
- mockPool.intercept({
657
- path: '/comm-central/raw-file/tip/mail/components/extensions/schemas/accounts.json',
658
- method: 'GET'
659
- }).reply(200, '{ "mail": "accounts.json" }');
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
- path.join(process.cwd(), 'schemas', 'mail', 'mailext.json');
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('https://hg.mozilla.org/mozilla-central/raw-file/tip/');
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.intercept({
685
- path: `${url.pathname}browser/components/extensions/schemas/${item}`,
686
- method: 'GET'
687
- }).reply(200, `{ "browser": "${item}" }`);
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', 'experiments.json', 'extension.json', 'i18n.json',
691
- 'management.json', 'permissions.json', 'runtime.json', 'theme.json'
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.intercept({
695
- path: `${url.pathname}toolkit/components/extensions/schemas/${item}`,
696
- method: 'GET'
697
- }).reply(200, `{ "toolkit": "${item}" }`);
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.intercept({
700
- path: '/comm-central/raw-file/tip/mail/components/extensions/jar.mn',
701
- method: 'GET'
702
- }).reply(200, '# comment\n\nmessenger.jar:\n% content/messenger/ext-mail.json\n content/messenger/schemas/accounts.json\n');
703
- mockPool.intercept({
704
- path: '/comm-central/raw-file/tip/mail/components/extensions/schemas/accounts.json',
705
- method: 'GET'
706
- }).reply(200, '{ "mail": "accounts.json" }');
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
- path.join(process.cwd(), 'schemas', 'mail', 'mailext.json');
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
- new URL('https://hg.mozilla.org/releases/mozilla-beta/raw-file/tip/');
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.intercept({
728
- path: `${url.pathname}browser/components/extensions/schemas/jar.mn`,
729
- method: 'GET'
730
- }).reply(200, 'content/extensions/schemas/foo.json\ncontent/extensions/schemas/bar.json\n');
731
- mockPool.intercept({
732
- path: `${url.pathname}browser/components/extensions/schemas/foo.json`,
733
- method: 'GET'
734
- }).reply(200, '{ "browser": "foo.json" }');
735
- mockPool.intercept({
736
- path: `${url.pathname}browser/components/extensions/schemas/bar.json`,
737
- method: 'GET'
738
- }).reply(200, '{ "browser": "bar.json" }');
739
- mockPool.intercept({
740
- path: `${url.pathname}toolkit/components/extensions/schemas/jar.mn`,
741
- method: 'GET'
742
- }).reply(200, 'content/extensions/schemas/baz.json\ncontent/extensions/schemas/qux.json\n');
743
- mockPool.intercept({
744
- path: `${url.pathname}toolkit/components/extensions/schemas/baz.json`,
745
- method: 'GET'
746
- }).reply(200, '{ "toolkit": "baz.json" }');
747
- mockPool.intercept({
748
- path: `${url.pathname}toolkit/components/extensions/schemas/qux.json`,
749
- method: 'GET'
750
- }).reply(200, '{ "toolkit": "qux.json" }');
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
- new URL('https://hg.mozilla.org/releases/mozilla-beta/raw-file/tip/');
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.intercept({
772
- path: `${url.pathname}browser/components/extensions/schemas/jar.mn`,
773
- method: 'GET'
774
- }).reply(200, 'content/extensions/schemas/foo.json\ncontent/extensions/schemas/bar.json\n');
775
- mockPool.intercept({
776
- path: `${url.pathname}browser/components/extensions/schemas/foo.json`,
777
- method: 'GET'
778
- }).reply(200, '{ "browser": "foo.json" }');
779
- mockPool.intercept({
780
- path: `${url.pathname}browser/components/extensions/schemas/bar.json`,
781
- method: 'GET'
782
- }).reply(200, '{ "browser": "bar.json" }');
783
- mockPool.intercept({
784
- path: `${url.pathname}toolkit/components/extensions/schemas/jar.mn`,
785
- method: 'GET'
786
- }).reply(200, 'content/extensions/schemas/baz.json\ncontent/extensions/schemas/qux.json\n');
787
- mockPool.intercept({
788
- path: `${url.pathname}toolkit/components/extensions/schemas/baz.json`,
789
- method: 'GET'
790
- }).reply(200, '{ "toolkit": "baz.json" }');
791
- mockPool.intercept({
792
- path: `${url.pathname}toolkit/components/extensions/schemas/qux.json`,
793
- method: 'GET'
794
- }).reply(200, '{ "toolkit": "qux.json" }');
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('https://hg.mozilla.org/mozilla-central/raw-file/tip/');
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.intercept({
835
- path: `${item}browser/components/extensions/schemas/jar.mn`,
836
- method: 'GET'
837
- }).reply(200, 'content/extensions/schemas/foo.json\ncontent/extensions/schemas/bar.json\n');
838
- mockPool.intercept({
839
- path: `${item}browser/components/extensions/schemas/foo.json`,
840
- method: 'GET'
841
- }).reply(200, '{ "browser": "foo.json" }');
842
- mockPool.intercept({
843
- path: `${item}browser/components/extensions/schemas/bar.json`,
844
- method: 'GET'
845
- }).reply(200, '{ "browser": "bar.json" }');
846
- mockPool.intercept({
847
- path: `${item}toolkit/components/extensions/schemas/jar.mn`,
848
- method: 'GET'
849
- }).reply(200, 'content/extensions/schemas/baz.json\ncontent/extensions/schemas/qux.json\n');
850
- mockPool.intercept({
851
- path: `${item}toolkit/components/extensions/schemas/baz.json`,
852
- method: 'GET'
853
- }).reply(200, '{ "toolkit": "baz.json" }');
854
- mockPool.intercept({
855
- path: `${item}toolkit/components/extensions/schemas/qux.json`,
856
- method: 'GET'
857
- }).reply(200, '{ "toolkit": "qux.json" }');
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.intercept({
865
- path: `${centralPath}browser/components/extensions/schemas/${item}`,
866
- method: 'GET'
867
- }).reply(200, `{ "browser": "${item}" }`);
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', 'experiments.json', 'extension.json', 'i18n.json',
871
- 'management.json', 'permissions.json', 'runtime.json', 'theme.json'
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.intercept({
875
- path: `${centralPath}toolkit/components/extensions/schemas/${item}`,
876
- method: 'GET'
877
- }).reply(200, `{ "toolkit": "${item}" }`);
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.intercept({
880
- path: `${mailPath}mail/components/extensions/jar.mn`,
881
- method: 'GET'
882
- }).reply(200, 'content/messenger/schemas/quux.json\n');
883
- mockPool.intercept({
884
- path: `${mailPath}mail/components/extensions/schemas/quux.json`,
885
- method: 'GET'
886
- }).reply(200, '{ "mail": "quux.json" }');
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('https://hg.mozilla.org/mozilla-central/raw-file/tip/');
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.intercept({
907
- path: `${item}browser/components/extensions/schemas/jar.mn`,
908
- method: 'GET'
909
- }).reply(200, 'content/extensions/schemas/foo.json\ncontent/extensions/schemas/bar.json\n');
910
- mockPool.intercept({
911
- path: `${item}browser/components/extensions/schemas/foo.json`,
912
- method: 'GET'
913
- }).reply(200, '{ "browser": "foo.json" }');
914
- mockPool.intercept({
915
- path: `${item}browser/components/extensions/schemas/bar.json`,
916
- method: 'GET'
917
- }).reply(200, '{ "browser": "bar.json" }');
918
- mockPool.intercept({
919
- path: `${item}toolkit/components/extensions/schemas/jar.mn`,
920
- method: 'GET'
921
- }).reply(200, 'content/extensions/schemas/baz.json\ncontent/extensions/schemas/qux.json\n');
922
- mockPool.intercept({
923
- path: `${item}toolkit/components/extensions/schemas/baz.json`,
924
- method: 'GET'
925
- }).reply(200, '{ "toolkit": "baz.json" }');
926
- mockPool.intercept({
927
- path: `${item}toolkit/components/extensions/schemas/qux.json`,
928
- method: 'GET'
929
- }).reply(200, '{ "toolkit": "qux.json" }');
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.intercept({
937
- path: `${centralPath}browser/components/extensions/schemas/${item}`,
938
- method: 'GET'
939
- }).reply(200, `{ "browser": "${item}" }`);
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', 'experiments.json', 'extension.json', 'i18n.json',
943
- 'management.json', 'permissions.json', 'runtime.json', 'theme.json'
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.intercept({
947
- path: `${centralPath}toolkit/components/extensions/schemas/${item}`,
948
- method: 'GET'
949
- }).reply(200, `{ "toolkit": "${item}" }`);
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.intercept({
952
- path: `${mailPath}mail/components/extensions/jar.mn`,
953
- method: 'GET'
954
- }).reply(200, 'content/messenger/schemas/quux.json\n');
955
- mockPool.intercept({
956
- path: `${mailPath}mail/components/extensions/schemas/quux.json`,
957
- method: 'GET'
958
- }).reply(400, '{ "ok": false, "status": 400 }');
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
- new URL('https://hg.mozilla.org/releases/mozilla-beta/raw-file/tip/');
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.intercept({
976
- path: `${url.pathname}browser/components/extensions/schemas/jar.mn`,
977
- method: 'GET'
978
- }).reply(200, 'content/extensions/schemas/foo.json\ncontent/extensions/schemas/bar.json\n');
979
- mockPool.intercept({
980
- path: `${url.pathname}browser/components/extensions/schemas/foo.json`,
981
- method: 'GET'
982
- }).reply(200, '{ "browser": "foo.json" }');
983
- mockPool.intercept({
984
- path: `${url.pathname}browser/components/extensions/schemas/bar.json`,
985
- method: 'GET'
986
- }).reply(200, '{ "browser": "bar.json" }');
987
- mockPool.intercept({
988
- path: `${url.pathname}toolkit/components/extensions/schemas/jar.mn`,
989
- method: 'GET'
990
- }).reply(200, 'content/extensions/schemas/baz.json\ncontent/extensions/schemas/qux.json\n');
991
- mockPool.intercept({
992
- path: `${url.pathname}toolkit/components/extensions/schemas/baz.json`,
993
- method: 'GET'
994
- }).reply(200, '{ "toolkit": "baz.json" }');
995
- mockPool.intercept({
996
- path: `${url.pathname}toolkit/components/extensions/schemas/qux.json`,
997
- method: 'GET'
998
- }).reply(200, '{ "toolkit": "qux.json" }');
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
- new URL('https://hg.mozilla.org/releases/mozilla-beta/raw-file/tip/');
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.intercept({
1018
- path: `${url.pathname}browser/components/extensions/schemas/jar.mn`,
1019
- method: 'GET'
1020
- }).reply(200, 'content/extensions/schemas/foo.json\ncontent/extensions/schemas/bar.json\n');
1021
- mockPool.intercept({
1022
- path: `${url.pathname}browser/components/extensions/schemas/foo.json`,
1023
- method: 'GET'
1024
- }).reply(200, '{ "browser": "foo.json" }');
1025
- mockPool.intercept({
1026
- path: `${url.pathname}browser/components/extensions/schemas/bar.json`,
1027
- method: 'GET'
1028
- }).reply(200, '{ "browser": "bar.json" }');
1029
- mockPool.intercept({
1030
- path: `${url.pathname}toolkit/components/extensions/schemas/jar.mn`,
1031
- method: 'GET'
1032
- }).reply(200, 'content/extensions/schemas/baz.json\ncontent/extensions/schemas/qux.json\n');
1033
- mockPool.intercept({
1034
- path: `${url.pathname}toolkit/components/extensions/schemas/baz.json`,
1035
- method: 'GET'
1036
- }).reply(200, '{ "toolkit": "baz.json" }');
1037
- mockPool.intercept({
1038
- path: `${url.pathname}toolkit/components/extensions/schemas/qux.json`,
1039
- method: 'GET'
1040
- }).reply(400, '{ "ok": false, "status": 400 }');
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;