@opentermsarchive/engine 1.1.2 → 1.1.3

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/.eslintrc.yaml CHANGED
@@ -10,6 +10,7 @@ plugins:
10
10
  - chai-friendly
11
11
  - import
12
12
  - json-format
13
+ - no-only-tests
13
14
  rules:
14
15
  arrow-parens:
15
16
  - error
@@ -101,6 +102,7 @@ rules:
101
102
  - error
102
103
  - properties: false
103
104
  require-await: 1
105
+ no-only-tests/no-only-tests: error
104
106
 
105
107
  overrides:
106
108
  - files:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentermsarchive/engine",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Tracks and makes visible changes to the terms of online services",
5
5
  "homepage": "https://opentermsarchive.org",
6
6
  "bugs": {
@@ -103,6 +103,7 @@
103
103
  "devDependencies": {
104
104
  "@commitlint/cli": "^19.0.3",
105
105
  "dir-compare": "^4.0.0",
106
+ "eslint-plugin-no-only-tests": "^3.1.0",
106
107
  "keep-a-changelog": "^2.5.3",
107
108
  "nock": "^13.2.1",
108
109
  "node-stream-zip": "^1.15.0",
@@ -0,0 +1,9 @@
1
+ {
2
+ "Terms of Service": [
3
+ {
4
+ "fetch": "https://domain.example/tos",
5
+ "select": "body",
6
+ "validUntil": "2024-03-18T18:30:09Z"
7
+ }
8
+ ]
9
+ }
@@ -43,6 +43,10 @@ export default class DeclarationUtils {
43
43
  await Promise.all(modifiedFilePaths.map(async modifiedFilePath => {
44
44
  const serviceId = DeclarationUtils.getServiceIdFromFilePath(modifiedFilePath);
45
45
 
46
+ if (modifiedFilePath.endsWith('.history.json')) {
47
+ return; // Assuming history modifications imply corresponding changes in the service declaration and that the analysis of which terms types of this service have changed will be done when analysing the related declaration, no further action is required here
48
+ }
49
+
46
50
  if (modifiedFilePath.endsWith('.filters.js')) {
47
51
  const declaration = await this.getJSONFromFile(this.defaultBranch, `declarations/${serviceId}.json`);
48
52
 
@@ -15,6 +15,7 @@ const SUBJECT_PATH = path.resolve(__dirname, './test');
15
15
  const FIXTURES = {
16
16
  serviceA: { path: './fixtures/serviceA.json' },
17
17
  serviceATermsUpdated: { path: './fixtures/serviceATermsUpdated.json' },
18
+ serviceATermsUpdatedHistory: { path: './fixtures/serviceATermsUpdated.history.json' },
18
19
  serviceAMultipleTermsUpdated: { path: './fixtures/serviceAMultipleTermsUpdated.json' },
19
20
  serviceATermsAdded: { path: './fixtures/serviceATermsAdded.json' },
20
21
  serviceATermsRemoved: { path: './fixtures/serviceATermsRemoved.json' },
@@ -23,6 +24,7 @@ const FIXTURES = {
23
24
 
24
25
  const COMMIT_PATHS = {
25
26
  serviceA: './declarations/ServiceA.json',
27
+ serviceAHistory: './declarations/ServiceA.history.json',
26
28
  serviceB: './declarations/ServiceB.json',
27
29
  };
28
30
 
@@ -36,7 +38,7 @@ const removeLatestCommit = async () => {
36
38
  await declarationUtils.git.reset('hard', ['HEAD~1']);
37
39
  };
38
40
 
39
- describe.only('DeclarationUtils', () => {
41
+ describe('DeclarationUtils', () => {
40
42
  describe('#getModifiedServicesAndTermsTypes', () => {
41
43
  before(async () => {
42
44
  await loadFixtures();
@@ -46,8 +48,14 @@ describe.only('DeclarationUtils', () => {
46
48
  after(() => fs.rm(SUBJECT_PATH, { recursive: true }));
47
49
 
48
50
  context('when an existing declaration has been modified', () => {
49
- before(() => commitChanges(COMMIT_PATHS.serviceA, FIXTURES.serviceATermsUpdated.content));
50
- after(removeLatestCommit);
51
+ before(async () => {
52
+ await commitChanges(COMMIT_PATHS.serviceA, FIXTURES.serviceATermsUpdated.content);
53
+ await commitChanges(COMMIT_PATHS.serviceAHistory, FIXTURES.serviceATermsUpdatedHistory.content);
54
+ });
55
+ after(async () => {
56
+ await removeLatestCommit();
57
+ await removeLatestCommit();
58
+ });
51
59
 
52
60
  it('returns the service ID and the updated terms type', async () => {
53
61
  expect(await declarationUtils.getModifiedServicesAndTermsTypes()).to.deep.equal({
@@ -82,7 +90,7 @@ describe.only('DeclarationUtils', () => {
82
90
  });
83
91
 
84
92
  context('when a declaration has been removed', () => {
85
- before(() => removeLatestCommit(declarationUtils.git));
93
+ before(removeLatestCommit);
86
94
  after(async () => {
87
95
  await fs.mkdir(path.resolve(SUBJECT_PATH, './declarations'), { recursive: true });
88
96
  await commitChanges(COMMIT_PATHS.serviceA, FIXTURES.serviceA.content);
@@ -41,7 +41,7 @@ export default async options => {
41
41
  }
42
42
 
43
43
  describe('Service declarations validation', async function () {
44
- this.timeout(30000);
44
+ this.timeout(60000);
45
45
  this.slow(SLOW_DOCUMENT_THRESHOLD);
46
46
 
47
47
  servicesToValidate.forEach(serviceId => {
@@ -20,7 +20,7 @@ const termsHTML = '<!DOCTYPE html><html><head><meta charset="UTF-8"><title>First
20
20
  const termsWithOtherCharsetHTML = '<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"><title>TOS на първия доставчик</title></head><body><h1>Условия за ползване</h1><p>Dapibus quis diam sagittis</p></body></html>';
21
21
 
22
22
  describe('Fetcher', function () {
23
- this.timeout(10000);
23
+ this.timeout(60000);
24
24
 
25
25
  before(launchHeadlessBrowser);
26
26