Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 5.1.4 #204

Merged
merged 5 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading