@opentermsarchive/engine 4.0.1 → 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
|
@@ -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)
|