Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AmsterGet committed May 22, 2024
1 parent 04d0a57 commit 31f6a37
Showing 1 changed file with 7 additions and 14 deletions.
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 31f6a37

Please sign in to comment.