Skip to content

Commit

Permalink
Merge pull request #204 from reportportal/develop
Browse files Browse the repository at this point in the history
Release 5.1.4
  • Loading branch information
AmsterGet authored May 22, 2024
2 parents d81fd2d + 31f6a37 commit 94d0015
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### Fixed
- Use correct launch search URL based on config mode while merging launches. Resolves [#200](https://github.com/reportportal/client-javascript/issues/200). Thanks to [hoangthanhtri](https://github.com/hoangthanhtri).
- Print launch UUID after merging launches. Resolves [#202](https://github.com/reportportal/client-javascript/issues/202). Thanks to [hoangthanhtri](https://github.com/hoangthanhtri).

## [5.1.3] - 2024-04-11
### Added
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.1.3
5.1.4-SNAPSHOT
8 changes: 6 additions & 2 deletions lib/report-portal-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ class RPClient {
'filter.in.uuid': launchUUIds,
'page.size': launchUUIds.length,
});
const launchSearchUrl = `launch?${params.toString()}`;
const launchSearchUrl = this.config.mode === 'DEBUG' ?
`launch/mode?${params.toString()}` : `launch?${params.toString()}`;
this.logDebug(`Find launches with UUIDs to merge: ${launchUUIds}`);
return this.restClient
.retrieveSyncAPI(launchSearchUrl, { headers: this.headers })
Expand All @@ -353,8 +354,11 @@ class RPClient {
const mergeURL = 'launch/merge';
return this.restClient.create(mergeURL, request, { headers: this.headers });
})
.then(() => {
.then((response) => {
this.logDebug(`Launches with UUIDs: ${launchUUIds} were successfully merged!`);
if (this.config.launchUuidPrint) {
this.config.launchUuidPrintOutput(response.uuid);
}
})
.catch((error) => {
this.logDebug(`Error merging launches with UUIDs: ${launchUUIds}`, error);
Expand Down
21 changes: 7 additions & 14 deletions spec/report-portal-client.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ describe('ReportPortal javascript client', () => {
name: 'Test launch name',
};

it('should calls client', (done) => {
it('should call rest client with required parameters', async () => {
const client = new RPClient({
apiKey: 'startLaunchTest',
endpoint: 'https://rp.us/api/v1',
Expand All @@ -564,16 +564,13 @@ describe('ReportPortal javascript client', () => {
const promise = client.mergeLaunches();

expect(promise.then).toBeDefined();
promise.then(() => {
expect(client.restClient.create).toHaveBeenCalledWith('launch/merge', fakeMergeDataRQ, {
headers: client.headers,
});

done();
await promise;
expect(client.restClient.create).toHaveBeenCalledWith('launch/merge', fakeMergeDataRQ, {
headers: client.headers,
});
});

it('should not call client if something went wrong', (done) => {
it('should not call rest client if something went wrong', async () => {
const client = new RPClient({
apiKey: 'startLaunchTest',
endpoint: 'https://rp.us/api/v1',
Expand All @@ -585,13 +582,9 @@ describe('ReportPortal javascript client', () => {
spyOn(client.restClient, 'retrieveSyncAPI').and.resolveTo();
spyOn(client.restClient, 'create').and.rejectWith();

const promise = client.mergeLaunches();

promise.then(() => {
expect(client.restClient.create).not.toHaveBeenCalled();
await client.mergeLaunches();

done();
});
expect(client.restClient.create).not.toHaveBeenCalled();
});

it('should return undefined if isLaunchMergeRequired is false', () => {
Expand Down

0 comments on commit 94d0015

Please sign in to comment.