@opentermsarchive/engine 1.2.1 → 1.3.0
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/package.json +4 -4
- package/scripts/dataset/export/index.js +16 -15
- package/scripts/declarations/lint/index.mocha.js +3 -3
- package/scripts/declarations/validate/index.mocha.js +5 -5
- package/scripts/history/migrate-services.js +1 -1
- package/scripts/import/index.js +1 -1
- package/scripts/utils/renamer/index.js +26 -24
- package/scripts/utils/renamer/rules/serviceNames.json +6 -1
- package/src/api/routes/docs.test.js +2 -2
- package/src/api/routes/versions.test.js +1 -1
- package/src/archivist/fetcher/fullDomFetcher.js +5 -5
- package/src/archivist/fetcher/index.test.js +5 -5
- package/src/archivist/index.test.js +16 -16
- package/src/archivist/recorder/index.js +4 -4
- package/src/archivist/recorder/index.test.js +29 -29
- package/src/archivist/recorder/repositories/git/git.js +6 -6
- package/src/archivist/recorder/repositories/git/index.js +4 -2
- package/src/archivist/recorder/repositories/git/index.test.js +65 -44
- package/src/archivist/recorder/repositories/interface.js +3 -0
- package/src/archivist/recorder/repositories/mongo/index.js +3 -3
- package/src/archivist/recorder/repositories/mongo/index.test.js +36 -36
- package/src/archivist/recorder/snapshot.test.js +4 -4
- package/src/archivist/recorder/version.test.js +4 -4
- package/src/archivist/services/index.test.js +16 -16
- package/src/archivist/services/sourceDocument.test.js +11 -11
- package/src/archivist/services/terms.test.js +2 -2
- package/src/notifier/index.js +2 -2
|
@@ -81,7 +81,7 @@ describe('MongoRepository', () => {
|
|
|
81
81
|
}));
|
|
82
82
|
});
|
|
83
83
|
|
|
84
|
-
after(
|
|
84
|
+
after(() => subject.removeAll());
|
|
85
85
|
|
|
86
86
|
it('saves the record', () => {
|
|
87
87
|
expect(numberOfRecordsAfter).to.equal(numberOfRecordsBefore + 1);
|
|
@@ -156,7 +156,7 @@ describe('MongoRepository', () => {
|
|
|
156
156
|
}).limit(1).sort({ created_at: -1 }).toArray());
|
|
157
157
|
});
|
|
158
158
|
|
|
159
|
-
after(
|
|
159
|
+
after(() => subject.removeAll());
|
|
160
160
|
|
|
161
161
|
it('saves the record', () => {
|
|
162
162
|
expect(numberOfRecordsAfter).to.equal(numberOfRecordsBefore + 1);
|
|
@@ -200,7 +200,7 @@ describe('MongoRepository', () => {
|
|
|
200
200
|
}).count();
|
|
201
201
|
});
|
|
202
202
|
|
|
203
|
-
after(
|
|
203
|
+
after(() => subject.removeAll());
|
|
204
204
|
|
|
205
205
|
it('does not save the record', () => {
|
|
206
206
|
expect(numberOfRecordsAfter).to.equal(numberOfRecordsBefore);
|
|
@@ -248,7 +248,7 @@ describe('MongoRepository', () => {
|
|
|
248
248
|
}).limit(1).sort({ created_at: -1 }).toArray());
|
|
249
249
|
});
|
|
250
250
|
|
|
251
|
-
after(
|
|
251
|
+
after(() => subject.removeAll());
|
|
252
252
|
|
|
253
253
|
it('saves the record', () => {
|
|
254
254
|
expect(numberOfRecordsAfter).to.equal(numberOfRecordsBefore + 1);
|
|
@@ -279,7 +279,7 @@ describe('MongoRepository', () => {
|
|
|
279
279
|
}));
|
|
280
280
|
});
|
|
281
281
|
|
|
282
|
-
after(
|
|
282
|
+
after(() => subject.removeAll());
|
|
283
283
|
|
|
284
284
|
it('stores snapshot ID', () => {
|
|
285
285
|
const snapshotIds = mongoDocument.snapshotIds.map(id => id.toString());
|
|
@@ -315,7 +315,7 @@ describe('MongoRepository', () => {
|
|
|
315
315
|
}));
|
|
316
316
|
});
|
|
317
317
|
|
|
318
|
-
after(
|
|
318
|
+
after(() => subject.removeAll());
|
|
319
319
|
|
|
320
320
|
it('stores snapshots IDs', () => {
|
|
321
321
|
const snapshotIds = mongoDocument.snapshotIds.map(id => id.toString());
|
|
@@ -350,7 +350,7 @@ describe('MongoRepository', () => {
|
|
|
350
350
|
(record = await subject.findById(id));
|
|
351
351
|
});
|
|
352
352
|
|
|
353
|
-
after(
|
|
353
|
+
after(() => subject.removeAll());
|
|
354
354
|
|
|
355
355
|
it('returns a Version object', () => {
|
|
356
356
|
expect(record).to.be.an.instanceof(Version);
|
|
@@ -372,7 +372,7 @@ describe('MongoRepository', () => {
|
|
|
372
372
|
expect(record.termsType).to.equal(TERMS_TYPE);
|
|
373
373
|
});
|
|
374
374
|
|
|
375
|
-
it('returns the content',
|
|
375
|
+
it('returns the content', () => {
|
|
376
376
|
expect(record.content).to.equal(CONTENT);
|
|
377
377
|
});
|
|
378
378
|
|
|
@@ -429,7 +429,7 @@ describe('MongoRepository', () => {
|
|
|
429
429
|
recordFound = await subject.findByDate(SERVICE_PROVIDER_ID, TERMS_TYPE, oneHourBeforeFetchDateLater);
|
|
430
430
|
});
|
|
431
431
|
|
|
432
|
-
after(
|
|
432
|
+
after(() => subject.removeAll());
|
|
433
433
|
|
|
434
434
|
it('returns a Version object', () => {
|
|
435
435
|
expect(recordFound).to.be.an.instanceof(Version);
|
|
@@ -481,7 +481,7 @@ describe('MongoRepository', () => {
|
|
|
481
481
|
(records = await subject.findAll());
|
|
482
482
|
});
|
|
483
483
|
|
|
484
|
-
after(
|
|
484
|
+
after(() => subject.removeAll());
|
|
485
485
|
|
|
486
486
|
it('returns all records', () => {
|
|
487
487
|
expect(records.length).to.equal(3);
|
|
@@ -493,7 +493,7 @@ describe('MongoRepository', () => {
|
|
|
493
493
|
}
|
|
494
494
|
});
|
|
495
495
|
|
|
496
|
-
it('returns records in ascending order',
|
|
496
|
+
it('returns records in ascending order', () => {
|
|
497
497
|
expect(records.map(record => record.fetchDate)).to.deep.equal([ FETCH_DATE_EARLIER, FETCH_DATE, FETCH_DATE_LATER ]);
|
|
498
498
|
});
|
|
499
499
|
});
|
|
@@ -528,9 +528,9 @@ describe('MongoRepository', () => {
|
|
|
528
528
|
(count = await subject.count());
|
|
529
529
|
});
|
|
530
530
|
|
|
531
|
-
after(
|
|
531
|
+
after(() => subject.removeAll());
|
|
532
532
|
|
|
533
|
-
it('returns the proper count',
|
|
533
|
+
it('returns the proper count', () => {
|
|
534
534
|
expect(count).to.equal(3);
|
|
535
535
|
});
|
|
536
536
|
});
|
|
@@ -566,7 +566,7 @@ describe('MongoRepository', () => {
|
|
|
566
566
|
);
|
|
567
567
|
});
|
|
568
568
|
|
|
569
|
-
after(
|
|
569
|
+
after(() => subject.removeAll());
|
|
570
570
|
|
|
571
571
|
it('returns a Version object', () => {
|
|
572
572
|
expect(latestRecord).to.be.an.instanceof(Version);
|
|
@@ -589,7 +589,7 @@ describe('MongoRepository', () => {
|
|
|
589
589
|
latestRecord = await subject.findLatest(SERVICE_PROVIDER_ID, TERMS_TYPE);
|
|
590
590
|
});
|
|
591
591
|
|
|
592
|
-
it('returns null',
|
|
592
|
+
it('returns null', () => {
|
|
593
593
|
expect(latestRecord).to.equal(null);
|
|
594
594
|
});
|
|
595
595
|
});
|
|
@@ -638,13 +638,13 @@ describe('MongoRepository', () => {
|
|
|
638
638
|
}
|
|
639
639
|
});
|
|
640
640
|
|
|
641
|
-
after(
|
|
641
|
+
after(() => subject.removeAll());
|
|
642
642
|
|
|
643
|
-
it('iterates through all records',
|
|
643
|
+
it('iterates through all records', () => {
|
|
644
644
|
expect(ids).to.have.members(expectedIds);
|
|
645
645
|
});
|
|
646
646
|
|
|
647
|
-
it('iterates in ascending order',
|
|
647
|
+
it('iterates in ascending order', () => {
|
|
648
648
|
expect(fetchDates).to.deep.equal([ FETCH_DATE_EARLIER, FETCH_DATE, FETCH_DATE_LATER ]);
|
|
649
649
|
});
|
|
650
650
|
});
|
|
@@ -693,7 +693,7 @@ describe('MongoRepository', () => {
|
|
|
693
693
|
}));
|
|
694
694
|
});
|
|
695
695
|
|
|
696
|
-
after(
|
|
696
|
+
after(() => subject.removeAll());
|
|
697
697
|
|
|
698
698
|
it('saves the record', () => {
|
|
699
699
|
expect(numberOfRecordsAfter).to.equal(numberOfRecordsBefore + 1);
|
|
@@ -772,7 +772,7 @@ describe('MongoRepository', () => {
|
|
|
772
772
|
}).limit(1).sort({ created_at: -1 }).toArray());
|
|
773
773
|
});
|
|
774
774
|
|
|
775
|
-
after(
|
|
775
|
+
after(() => subject.removeAll());
|
|
776
776
|
|
|
777
777
|
it('saves the record', () => {
|
|
778
778
|
expect(numberOfRecordsAfter).to.equal(numberOfRecordsBefore + 1);
|
|
@@ -816,7 +816,7 @@ describe('MongoRepository', () => {
|
|
|
816
816
|
}).count();
|
|
817
817
|
});
|
|
818
818
|
|
|
819
|
-
after(
|
|
819
|
+
after(() => subject.removeAll());
|
|
820
820
|
|
|
821
821
|
it('does not save the record', () => {
|
|
822
822
|
expect(numberOfRecordsAfter).to.equal(numberOfRecordsBefore);
|
|
@@ -855,7 +855,7 @@ describe('MongoRepository', () => {
|
|
|
855
855
|
}));
|
|
856
856
|
});
|
|
857
857
|
|
|
858
|
-
after(
|
|
858
|
+
after(() => subject.removeAll());
|
|
859
859
|
|
|
860
860
|
it('saves the record', () => {
|
|
861
861
|
expect(numberOfRecordsAfter).to.equal(numberOfRecordsBefore + 1);
|
|
@@ -865,7 +865,7 @@ describe('MongoRepository', () => {
|
|
|
865
865
|
expect(mongoDocument._id.toString()).to.equal(record.id);
|
|
866
866
|
});
|
|
867
867
|
|
|
868
|
-
it('stores the proper content',
|
|
868
|
+
it('stores the proper content', () => {
|
|
869
869
|
const isSameContent = Buffer.compare(mongoDocument.content.buffer, PDF_CONTENT) == 0;
|
|
870
870
|
|
|
871
871
|
expect(isSameContent).to.be.true;
|
|
@@ -894,7 +894,7 @@ describe('MongoRepository', () => {
|
|
|
894
894
|
(record = await subject.findById(id));
|
|
895
895
|
});
|
|
896
896
|
|
|
897
|
-
after(
|
|
897
|
+
after(() => subject.removeAll());
|
|
898
898
|
|
|
899
899
|
it('returns a Snapshot object', () => {
|
|
900
900
|
expect(record).to.be.an.instanceof(Snapshot);
|
|
@@ -916,7 +916,7 @@ describe('MongoRepository', () => {
|
|
|
916
916
|
expect(record.termsType).to.equal(TERMS_TYPE);
|
|
917
917
|
});
|
|
918
918
|
|
|
919
|
-
it('returns the content',
|
|
919
|
+
it('returns the content', () => {
|
|
920
920
|
expect(record.content).to.equal(CONTENT);
|
|
921
921
|
});
|
|
922
922
|
|
|
@@ -978,7 +978,7 @@ describe('MongoRepository', () => {
|
|
|
978
978
|
(records = await subject.findAll());
|
|
979
979
|
});
|
|
980
980
|
|
|
981
|
-
after(
|
|
981
|
+
after(() => subject.removeAll());
|
|
982
982
|
|
|
983
983
|
it('returns all records', () => {
|
|
984
984
|
expect(records.length).to.equal(3);
|
|
@@ -990,7 +990,7 @@ describe('MongoRepository', () => {
|
|
|
990
990
|
}
|
|
991
991
|
});
|
|
992
992
|
|
|
993
|
-
it('returns records in ascending order',
|
|
993
|
+
it('returns records in ascending order', () => {
|
|
994
994
|
expect(records.map(record => record.fetchDate)).to.deep.equal([ FETCH_DATE_EARLIER, FETCH_DATE, FETCH_DATE_LATER ]);
|
|
995
995
|
});
|
|
996
996
|
});
|
|
@@ -1025,9 +1025,9 @@ describe('MongoRepository', () => {
|
|
|
1025
1025
|
(count = await subject.count());
|
|
1026
1026
|
});
|
|
1027
1027
|
|
|
1028
|
-
after(
|
|
1028
|
+
after(() => subject.removeAll());
|
|
1029
1029
|
|
|
1030
|
-
it('returns the proper count',
|
|
1030
|
+
it('returns the proper count', () => {
|
|
1031
1031
|
expect(count).to.equal(3);
|
|
1032
1032
|
});
|
|
1033
1033
|
});
|
|
@@ -1063,7 +1063,7 @@ describe('MongoRepository', () => {
|
|
|
1063
1063
|
);
|
|
1064
1064
|
});
|
|
1065
1065
|
|
|
1066
|
-
after(
|
|
1066
|
+
after(() => subject.removeAll());
|
|
1067
1067
|
|
|
1068
1068
|
it('returns a Snapshot object', () => {
|
|
1069
1069
|
expect(latestRecord).to.be.an.instanceof(Snapshot);
|
|
@@ -1103,13 +1103,13 @@ describe('MongoRepository', () => {
|
|
|
1103
1103
|
latestRecord = await subject.findLatest(SERVICE_PROVIDER_ID, TERMS_TYPE);
|
|
1104
1104
|
});
|
|
1105
1105
|
|
|
1106
|
-
after(
|
|
1106
|
+
after(() => subject.removeAll());
|
|
1107
1107
|
|
|
1108
1108
|
it('returns the latest record id', () => {
|
|
1109
1109
|
expect(latestRecord.id).to.include(lastSnapshotId);
|
|
1110
1110
|
});
|
|
1111
1111
|
|
|
1112
|
-
it('returns the latest record content',
|
|
1112
|
+
it('returns the latest record content', () => {
|
|
1113
1113
|
const isSameContent = Buffer.compare(latestRecord.content, UPDATED_PDF_CONTENT) == 0;
|
|
1114
1114
|
|
|
1115
1115
|
expect(isSameContent).to.be.true;
|
|
@@ -1128,7 +1128,7 @@ describe('MongoRepository', () => {
|
|
|
1128
1128
|
latestRecord = await subject.findLatest(SERVICE_PROVIDER_ID, TERMS_TYPE);
|
|
1129
1129
|
});
|
|
1130
1130
|
|
|
1131
|
-
it('returns null',
|
|
1131
|
+
it('returns null', () => {
|
|
1132
1132
|
expect(latestRecord).to.equal(null);
|
|
1133
1133
|
});
|
|
1134
1134
|
});
|
|
@@ -1177,13 +1177,13 @@ describe('MongoRepository', () => {
|
|
|
1177
1177
|
}
|
|
1178
1178
|
});
|
|
1179
1179
|
|
|
1180
|
-
after(
|
|
1180
|
+
after(() => subject.removeAll());
|
|
1181
1181
|
|
|
1182
|
-
it('iterates through all records',
|
|
1182
|
+
it('iterates through all records', () => {
|
|
1183
1183
|
expect(ids).to.have.members(expectedIds);
|
|
1184
1184
|
});
|
|
1185
1185
|
|
|
1186
|
-
it('iterates in ascending order',
|
|
1186
|
+
it('iterates in ascending order', () => {
|
|
1187
1187
|
expect(fetchDates).to.deep.equal([ FETCH_DATE_EARLIER, FETCH_DATE, FETCH_DATE_LATER ]);
|
|
1188
1188
|
});
|
|
1189
1189
|
});
|
|
@@ -20,14 +20,14 @@ describe('Snapshot', () => {
|
|
|
20
20
|
|
|
21
21
|
describe(`"${requiredParam}"`, () => {
|
|
22
22
|
context('when missing', () => {
|
|
23
|
-
it('throws an error',
|
|
23
|
+
it('throws an error', () => {
|
|
24
24
|
subject = new Snapshot({ ...validParamsExceptTheOneTested });
|
|
25
25
|
expect(subject.validate.bind(subject)).to.throw(RegExp(requiredParam));
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
context('when null', () => {
|
|
30
|
-
it('throws an error',
|
|
30
|
+
it('throws an error', () => {
|
|
31
31
|
subject = new Snapshot({ ...validParamsExceptTheOneTested, [requiredParam]: null });
|
|
32
32
|
expect(subject.validate.bind(subject)).to.throw(RegExp(requiredParam));
|
|
33
33
|
});
|
|
@@ -44,12 +44,12 @@ describe('Snapshot', () => {
|
|
|
44
44
|
fetchDate: new Date('2000-01-01T12:00:00.000Z'),
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
before(
|
|
47
|
+
before(() => {
|
|
48
48
|
subject = new Snapshot(recordParams);
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
context('when it is neither defined nor loaded', () => {
|
|
52
|
-
it('throws an error explaining how to recover',
|
|
52
|
+
it('throws an error explaining how to recover', () => {
|
|
53
53
|
try {
|
|
54
54
|
console.log(subject.content);
|
|
55
55
|
} catch (e) {
|
|
@@ -20,14 +20,14 @@ describe('Version', () => {
|
|
|
20
20
|
|
|
21
21
|
describe(`"${requiredParam}"`, () => {
|
|
22
22
|
context('when missing', () => {
|
|
23
|
-
it('throws an error',
|
|
23
|
+
it('throws an error', () => {
|
|
24
24
|
subject = new Version({ ...validParamsExceptTheOneTested });
|
|
25
25
|
expect(subject.validate.bind(subject)).to.throw(RegExp(requiredParam));
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
context('when null', () => {
|
|
30
|
-
it('throws an error',
|
|
30
|
+
it('throws an error', () => {
|
|
31
31
|
subject = new Version({ ...validParamsExceptTheOneTested, [requiredParam]: null });
|
|
32
32
|
expect(subject.validate.bind(subject)).to.throw(RegExp(requiredParam));
|
|
33
33
|
});
|
|
@@ -44,12 +44,12 @@ describe('Version', () => {
|
|
|
44
44
|
snapshotIds: ['dd263f270b3065e1c18201b49ab898474b357566'],
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
before(
|
|
47
|
+
before(() => {
|
|
48
48
|
subject = new Version(recordParams);
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
context('when it is neither defined nor loaded', () => {
|
|
52
|
-
it('throws an error explaining how to recover',
|
|
52
|
+
it('throws an error explaining how to recover', () => {
|
|
53
53
|
try {
|
|
54
54
|
console.log(subject.content);
|
|
55
55
|
} catch (e) {
|
|
@@ -12,7 +12,7 @@ describe('Services', () => {
|
|
|
12
12
|
describe('#load', () => {
|
|
13
13
|
let result;
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
function validateServiceWithoutHistory(serviceId, expected) {
|
|
16
16
|
/* eslint-disable no-loop-func */
|
|
17
17
|
for (const termsType of expected.getTermsTypes()) {
|
|
18
18
|
context(`${termsType}`, () => {
|
|
@@ -59,20 +59,20 @@ describe('Services', () => {
|
|
|
59
59
|
expect(actualTerms.validUntil).to.be.undefined;
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
-
it('has the proper content selectors',
|
|
62
|
+
it('has the proper content selectors', () => {
|
|
63
63
|
expect(actualContentSelectors).to.equal(expectedContentSelectors);
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
it('has the proper insignificant content selectors',
|
|
66
|
+
it('has the proper insignificant content selectors', () => {
|
|
67
67
|
expect(actualInsignificantContentSelectors).to.equal(expectedInsignificantContentSelectors);
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
-
it('has the proper executeClientScripts option',
|
|
70
|
+
it('has the proper executeClientScripts option', () => {
|
|
71
71
|
expect(actualExecuteClientScripts).to.equal(expectedExecuteClientScripts);
|
|
72
72
|
});
|
|
73
73
|
|
|
74
74
|
if (expectedFilters) {
|
|
75
|
-
it('has the proper number of filter functions',
|
|
75
|
+
it('has the proper number of filter functions', () => {
|
|
76
76
|
expect(actualFilters.length).to.equal(expectedFilters.length);
|
|
77
77
|
});
|
|
78
78
|
|
|
@@ -125,12 +125,12 @@ describe('Services', () => {
|
|
|
125
125
|
await validateServiceWithoutHistory('service_with_multiple_source_documents_terms', expectedServices.service_with_multiple_source_documents_terms);
|
|
126
126
|
});
|
|
127
127
|
|
|
128
|
-
context('when specifying services to load',
|
|
128
|
+
context('when specifying services to load', () => {
|
|
129
129
|
before(async () => {
|
|
130
130
|
result = await services.load([ 'service·A', 'Service B!' ]);
|
|
131
131
|
});
|
|
132
132
|
|
|
133
|
-
it('loads only the given services',
|
|
133
|
+
it('loads only the given services', () => {
|
|
134
134
|
expect(result).to.have.all.keys('service·A', 'Service B!');
|
|
135
135
|
});
|
|
136
136
|
});
|
|
@@ -139,7 +139,7 @@ describe('Services', () => {
|
|
|
139
139
|
describe('#loadWithHistory', () => {
|
|
140
140
|
let result;
|
|
141
141
|
|
|
142
|
-
|
|
142
|
+
function validateServiceWithHistory(serviceId, expected) {
|
|
143
143
|
/* eslint-disable no-loop-func */
|
|
144
144
|
for (const termsType of expected.getTermsTypes()) {
|
|
145
145
|
context(`${termsType}`, () => {
|
|
@@ -201,20 +201,20 @@ describe('Services', () => {
|
|
|
201
201
|
} = actualDocumentsForThisDate[index]);
|
|
202
202
|
});
|
|
203
203
|
|
|
204
|
-
it('has the proper content selectors',
|
|
204
|
+
it('has the proper content selectors', () => {
|
|
205
205
|
expect(contentSelectorsForThisDate).to.equal(expectedContentSelectors);
|
|
206
206
|
});
|
|
207
207
|
|
|
208
|
-
it('has the proper insignificant content selectors',
|
|
208
|
+
it('has the proper insignificant content selectors', () => {
|
|
209
209
|
expect(insignificantContentSelectorsForThisDate).to.equal(expectedInsignificantContentSelectors);
|
|
210
210
|
});
|
|
211
211
|
|
|
212
|
-
it('has the proper executeClientScripts option',
|
|
212
|
+
it('has the proper executeClientScripts option', () => {
|
|
213
213
|
expect(actualExecuteClientScriptsForThisDate).to.equal(expectedExecuteClientScriptsForThisDate);
|
|
214
214
|
});
|
|
215
215
|
|
|
216
216
|
if (expectedFiltersForThisDate) {
|
|
217
|
-
it('has the proper number of filter functions',
|
|
217
|
+
it('has the proper number of filter functions', () => {
|
|
218
218
|
expect(actualFiltersForThisDate.length).to.equal(expectedFiltersForThisDate.length);
|
|
219
219
|
});
|
|
220
220
|
|
|
@@ -231,12 +231,12 @@ describe('Services', () => {
|
|
|
231
231
|
});
|
|
232
232
|
}
|
|
233
233
|
} else {
|
|
234
|
-
it('has no history',
|
|
234
|
+
it('has no history', () => {
|
|
235
235
|
expect(actualTerms.validUntil).to.be.undefined;
|
|
236
236
|
});
|
|
237
237
|
|
|
238
238
|
if (expectedFilters) {
|
|
239
|
-
it('has the proper number of filter functions',
|
|
239
|
+
it('has the proper number of filter functions', () => {
|
|
240
240
|
expect(actualFilters.length).to.equal(expectedFilters.length);
|
|
241
241
|
});
|
|
242
242
|
|
|
@@ -294,12 +294,12 @@ describe('Services', () => {
|
|
|
294
294
|
await validateServiceWithHistory('service_with_multiple_source_documents_terms', expectedServices.service_with_multiple_source_documents_terms);
|
|
295
295
|
});
|
|
296
296
|
|
|
297
|
-
context('when specifying services to load',
|
|
297
|
+
context('when specifying services to load', () => {
|
|
298
298
|
before(async () => {
|
|
299
299
|
result = await services.loadWithHistory([ 'service·A', 'Service B!' ]);
|
|
300
300
|
});
|
|
301
301
|
|
|
302
|
-
it('loads only the given services',
|
|
302
|
+
it('loads only the given services', () => {
|
|
303
303
|
expect(result).to.have.all.keys('service·A', 'Service B!');
|
|
304
304
|
});
|
|
305
305
|
});
|
|
@@ -10,7 +10,7 @@ describe('SourceDocument', () => {
|
|
|
10
10
|
describe('#getCssSelectors', () => {
|
|
11
11
|
context('with "select" property', () => {
|
|
12
12
|
context('with string selector', () => {
|
|
13
|
-
it('extracts selectors',
|
|
13
|
+
it('extracts selectors', () => {
|
|
14
14
|
const result = new SourceDocument({ location: URL, contentSelectors: 'body' }).cssSelectors;
|
|
15
15
|
|
|
16
16
|
expect(result).to.deep.equal(['body']);
|
|
@@ -18,7 +18,7 @@ describe('SourceDocument', () => {
|
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
context('with range selector', () => {
|
|
21
|
-
it('extracts selectors',
|
|
21
|
+
it('extracts selectors', () => {
|
|
22
22
|
const result = new SourceDocument({
|
|
23
23
|
location: URL,
|
|
24
24
|
contentSelectors: {
|
|
@@ -32,7 +32,7 @@ describe('SourceDocument', () => {
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
context('with an array of mixed selectors', () => {
|
|
35
|
-
it('extracts selectors',
|
|
35
|
+
it('extracts selectors', () => {
|
|
36
36
|
const result = new SourceDocument({
|
|
37
37
|
location: URL,
|
|
38
38
|
contentSelectors: [
|
|
@@ -51,7 +51,7 @@ describe('SourceDocument', () => {
|
|
|
51
51
|
|
|
52
52
|
context('with "remove" property', () => {
|
|
53
53
|
context('with string selector', () => {
|
|
54
|
-
it('extracts selectors',
|
|
54
|
+
it('extracts selectors', () => {
|
|
55
55
|
const result = new SourceDocument({ location: URL, insignificantContentSelectors: 'body' }).cssSelectors;
|
|
56
56
|
|
|
57
57
|
expect(result).to.deep.equal(['body']);
|
|
@@ -59,7 +59,7 @@ describe('SourceDocument', () => {
|
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
context('with range selector', () => {
|
|
62
|
-
it('extracts selectors',
|
|
62
|
+
it('extracts selectors', () => {
|
|
63
63
|
const result = new SourceDocument({
|
|
64
64
|
location: URL,
|
|
65
65
|
insignificantContentSelectors: {
|
|
@@ -73,7 +73,7 @@ describe('SourceDocument', () => {
|
|
|
73
73
|
});
|
|
74
74
|
|
|
75
75
|
context('with an array of mixed selectors', () => {
|
|
76
|
-
it('extracts selectors',
|
|
76
|
+
it('extracts selectors', () => {
|
|
77
77
|
const result = new SourceDocument({
|
|
78
78
|
location: URL,
|
|
79
79
|
insignificantContentSelectors: [
|
|
@@ -92,7 +92,7 @@ describe('SourceDocument', () => {
|
|
|
92
92
|
|
|
93
93
|
context('with both "select" and "remove" property', () => {
|
|
94
94
|
context('with string selector', () => {
|
|
95
|
-
it('extracts selectors',
|
|
95
|
+
it('extracts selectors', () => {
|
|
96
96
|
const result = new SourceDocument({
|
|
97
97
|
location: URL,
|
|
98
98
|
contentSelectors: 'body',
|
|
@@ -104,7 +104,7 @@ describe('SourceDocument', () => {
|
|
|
104
104
|
});
|
|
105
105
|
|
|
106
106
|
context('with range selector', () => {
|
|
107
|
-
it('extracts selectors',
|
|
107
|
+
it('extracts selectors', () => {
|
|
108
108
|
const result = new SourceDocument({
|
|
109
109
|
location: URL,
|
|
110
110
|
contentSelectors: {
|
|
@@ -127,7 +127,7 @@ describe('SourceDocument', () => {
|
|
|
127
127
|
});
|
|
128
128
|
|
|
129
129
|
context('with an array of mixed selectors', () => {
|
|
130
|
-
it('extracts selectors',
|
|
130
|
+
it('extracts selectors', () => {
|
|
131
131
|
const result = new SourceDocument({
|
|
132
132
|
location: URL,
|
|
133
133
|
contentSelectors: [
|
|
@@ -160,7 +160,7 @@ describe('SourceDocument', () => {
|
|
|
160
160
|
});
|
|
161
161
|
|
|
162
162
|
describe('#toPersistence', () => {
|
|
163
|
-
it('converts basic source document declarations into JSON representation',
|
|
163
|
+
it('converts basic source document declarations into JSON representation', () => {
|
|
164
164
|
const result = new SourceDocument({
|
|
165
165
|
location: URL,
|
|
166
166
|
contentSelectors: 'body',
|
|
@@ -177,7 +177,7 @@ describe('SourceDocument', () => {
|
|
|
177
177
|
expect(result).to.deep.equal(expectedResult);
|
|
178
178
|
});
|
|
179
179
|
|
|
180
|
-
it('converts full source document declarations to JSON representation',
|
|
180
|
+
it('converts full source document declarations to JSON representation', () => {
|
|
181
181
|
const result = new SourceDocument({
|
|
182
182
|
location: URL,
|
|
183
183
|
contentSelectors: [
|
|
@@ -60,7 +60,7 @@ describe('Terms', () => {
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
describe('#toPersistence', () => {
|
|
63
|
-
it('converts terms with single source document to JSON representation',
|
|
63
|
+
it('converts terms with single source document to JSON representation', () => {
|
|
64
64
|
const result = new Terms({ service, type: termsType, sourceDocuments: [document1] }).toPersistence();
|
|
65
65
|
|
|
66
66
|
const expectedResult = {
|
|
@@ -71,7 +71,7 @@ describe('Terms', () => {
|
|
|
71
71
|
expect(result).to.deep.equal(expectedResult);
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
it('converts terms with multiple source documents to JSON representation',
|
|
74
|
+
it('converts terms with multiple source documents to JSON representation', () => {
|
|
75
75
|
const result = new Terms({ service, type: termsType, sourceDocuments: [ document1, document2 ] }).toPersistence();
|
|
76
76
|
|
|
77
77
|
const expectedResult = {
|
package/src/notifier/index.js
CHANGED
|
@@ -17,11 +17,11 @@ export default class Notifier {
|
|
|
17
17
|
this.delayedVersionNotificationsParams = [];
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
onVersionRecorded(record) {
|
|
21
21
|
this.delayedVersionNotificationsParams.push(record);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
onTrackingCompleted() {
|
|
25
25
|
this.delayedVersionNotificationsParams.forEach(async ({ serviceId, termsType, id }) => {
|
|
26
26
|
try {
|
|
27
27
|
await this.notifyVersionRecorded(serviceId, termsType, id);
|