@opentermsarchive/engine 4.0.0 → 4.0.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentermsarchive/engine",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Tracks and makes visible changes to the terms of online services",
5
5
  "homepage": "https://opentermsarchive.org",
6
6
  "bugs": {
@@ -58,6 +58,10 @@ const PACKAGE_JSON_PATH = '../../../package.json';
58
58
  * type: string
59
59
  * format: uri
60
60
  * description: URL to the snapshots repository
61
+ * donations:
62
+ * type: string
63
+ * format: uri
64
+ * description: URL to the donations page
61
65
  * logo:
62
66
  * type: string
63
67
  * format: uri
@@ -94,41 +98,23 @@ const PACKAGE_JSON_PATH = '../../../package.json';
94
98
  * description: The date when tracking ended for this period
95
99
  * governance:
96
100
  * type: object
97
- * properties:
98
- * hosts:
99
- * type: array
100
- * items:
101
- * $ref: '#/components/schemas/Organization'
102
- * administrators:
103
- * type: array
104
- * items:
105
- * $ref: '#/components/schemas/Organization'
106
- * curators:
107
- * type: array
108
- * items:
109
- * $ref: '#/components/schemas/Organization'
110
- * maintainers:
111
- * type: array
112
- * items:
113
- * $ref: '#/components/schemas/Organization'
114
- * sponsors:
115
- * type: array
116
- * items:
117
- * $ref: '#/components/schemas/Organization'
118
- * Organization:
119
- * type: object
120
- * properties:
121
- * name:
122
- * type: string
123
- * description: Name of the organization
124
- * url:
125
- * type: string
126
- * format: uri
127
- * description: URL to the organization's website
128
- * logo:
129
- * type: string
130
- * format: uri
131
- * description: URL to the organization's logo
101
+ * additionalProperties:
102
+ * type: object
103
+ * properties:
104
+ * url:
105
+ * type: string
106
+ * format: uri
107
+ * description: URL to the entity's website
108
+ * logo:
109
+ * type: string
110
+ * format: uri
111
+ * description: URL to the entity's logo
112
+ * roles:
113
+ * type: array
114
+ * items:
115
+ * type: string
116
+ * enum: [host, administrator, curator, maintainer, sponsor]
117
+ * description: Roles of the entity within the governance
132
118
  */
133
119
  export default async function metadataRouter(collectionPath, services) {
134
120
  const router = express.Router();
@@ -249,10 +249,9 @@ export default class GitLab {
249
249
 
250
250
  async getIssue({ title, ...searchParams }) {
251
251
  try {
252
- let apiUrl = `${this.apiBaseURL}/projects/${this.projectId}/issues?state=${searchParams.state}&per_page=100`;
252
+ let apiUrl = `${this.apiBaseURL}/projects/${this.projectId}/issues?search=${encodeURIComponent(title)}&state=${searchParams.state}&per_page=100`;
253
253
 
254
- if (searchParams.state == 'all') apiUrl = `${this.apiBaseURL}/projects/${this.projectId}/issues?per_page=100`;
255
- apiUrl = `${this.apiBaseURL}/projects/${this.projectId}/issues?search=${encodeURIComponent(title)}&per_page=100`;
254
+ if (searchParams.state == 'all') apiUrl = `${this.apiBaseURL}/projects/${this.projectId}/issues?search=${encodeURIComponent(title)}&per_page=100`;
256
255
 
257
256
  const options = GitLab.baseOptionsHttpReq();
258
257
 
@@ -212,7 +212,33 @@ describe('GitLab', function () {
212
212
  .get(`/projects/${PROJECT_ID}/issues?search=${encodeURIComponent(ISSUE.title)}&per_page=100`)
213
213
  .reply(200, [ ISSUE, ANOTHER_ISSUE ]);
214
214
 
215
- result = await gitlab.getIssue({ title: ISSUE.title });
215
+ result = await gitlab.getIssue({ title: ISSUE.title, state: GitLab.ISSUE_STATE_ALL });
216
+ });
217
+
218
+ after(nock.cleanAll);
219
+
220
+ it('searches for the issue', () => {
221
+ expect(scope.isDone()).to.be.true;
222
+ });
223
+
224
+ it('returns the expected issue', () => {
225
+ expect(result).to.deep.equal(ISSUE);
226
+ });
227
+ });
228
+
229
+ describe('#getIssueWithStatus', () => {
230
+ let scope;
231
+ let result;
232
+
233
+ const ISSUE = { number: 123, title: 'Test Issue', state: 'opened' };
234
+ const ANOTHER_ISSUE = { number: 124, title: 'Test Issue 2', state: 'opened' };
235
+
236
+ before(async () => {
237
+ scope = nock(gitlab.apiBaseURL)
238
+ .get(`/projects/${PROJECT_ID}/issues?search=${encodeURIComponent(ISSUE.title)}&state=${GitLab.ISSUE_STATE_OPEN}&per_page=100`)
239
+ .reply(200, [ ISSUE, ANOTHER_ISSUE ]);
240
+
241
+ result = await gitlab.getIssue({ title: ISSUE.title, state: GitLab.ISSUE_STATE_OPEN });
216
242
  });
217
243
 
218
244
  after(nock.cleanAll);
@@ -265,7 +291,7 @@ describe('GitLab', function () {
265
291
 
266
292
  before(async () => {
267
293
  nock(gitlab.apiBaseURL)
268
- .get(`/projects/${PROJECT_ID}/issues?search=${encodeURIComponent(ISSUE.title)}&per_page=100`)
294
+ .get(`/projects/${PROJECT_ID}/issues?search=${encodeURIComponent(ISSUE.title)}&state=${GitLab.ISSUE_STATE_OPEN}&per_page=100`)
269
295
  .reply(200, [ISSUE]);
270
296
 
271
297
  addCommentScope = nock(gitlab.apiBaseURL)