diff --git a/examples/user-management.v1.test.js b/examples/user-management.v1.test.js index ac2286c1..c3e9cbe9 100644 --- a/examples/user-management.v1.test.js +++ b/examples/user-management.v1.test.js @@ -81,6 +81,7 @@ describe('UserManagementV1', () => { let accessGroupId = config.accessGroupId; let deleteUserId = null; + jest.setTimeout(30000); test('inviteUsers request example', async () => { diff --git a/test/integration/case-management.v1.test.js b/test/integration/case-management.v1.test.js index 06803a2d..c106e806 100644 --- a/test/integration/case-management.v1.test.js +++ b/test/integration/case-management.v1.test.js @@ -61,11 +61,10 @@ describe('CaseManagementV1_integration', () => { contentType: 'image/png', }; - test('should successfully complete initialization', (done) => { + test('should successfully complete initialization', async () => { // Initialize the service client. service = CaseManagementV1.newInstance(); expect(service).not.toBeNull(); - done(); }); describe('Create a case', () => { @@ -83,28 +82,22 @@ describe('CaseManagementV1_integration', () => { response = undefined; }); - test('Successfully created a technical case', async (done) => { - try { - response = await service.createCase(params); - expect(response).toBeDefined(); - expect(response.status).toEqual(200); - const { result } = response || {}; + test('Successfully created a technical case', async () => { + response = await service.createCase(params); + expect(response).toBeDefined(); + expect(response.status).toEqual(200); + const { result } = response || {}; - expect(result).toBeDefined(); - expect(result.number).toBeDefined(); - expect(result.short_description).toEqual(params.subject); - expect(result.description).toEqual(params.description); + expect(result).toBeDefined(); + expect(result.number).toBeDefined(); + expect(result.short_description).toEqual(params.subject); + expect(result.description).toEqual(params.description); - caseNumber = result.number; - console.log('\nCase number: ', caseNumber); - - done(); - } catch (err) { - done(err); - } + caseNumber = result.number; + console.log('\nCase number: ', caseNumber); }); - test('Bad payload used to create a case', async (done) => { + test('Bad payload used to create a case', async () => { params.type = 'invalid_type'; params.severity = null; params.offering = null; @@ -113,10 +106,7 @@ describe('CaseManagementV1_integration', () => { response = await service.createCase(params); } catch (err) { expect(err.status).toEqual(400); - done(); } - - done(); }); }); @@ -129,25 +119,19 @@ describe('CaseManagementV1_integration', () => { params = {}; }); - test('Successfully got cases with default params', async (done) => { - try { - response = await service.getCases(); - expect(response).toBeDefined(); - expect(response.status).toEqual(200); - const { result } = response || {}; - - expect(result.total_count).toBeDefined(); - expect(result.first).toBeDefined(); - expect(result.last).toBeDefined(); - expect(result.cases).toBeDefined(); + test('Successfully got cases with default params', async () => { + response = await service.getCases(); + expect(response).toBeDefined(); + expect(response.status).toEqual(200); + const { result } = response || {}; - done(); - } catch (err) { - done(err); - } + expect(result.total_count).toBeDefined(); + expect(result.first).toBeDefined(); + expect(result.last).toBeDefined(); + expect(result.cases).toBeDefined(); }); - test('Successful got cases with non-default params', async (done) => { + test('Successful got cases with non-default params', async () => { params = { offset: 10, limit: 20, @@ -158,31 +142,25 @@ describe('CaseManagementV1_integration', () => { ], }; - try { - response = await service.getCases(params); - expect(response).toBeDefined(); - expect(response.status).toEqual(200); - const { result } = response || {}; - - expect(result.total_count).toBeDefined(); - expect(result.first).toBeDefined(); - expect(result.last).toBeDefined(); - expect(result.cases).toBeDefined(); - - const testCase = result.cases[0]; - expect(testCase).toBeDefined(); - expect(testCase.number).toBeDefined(); - expect(testCase.short_description).toBeDefined(); - expect(testCase.severity).toBeDefined(); - expect(testCase.comments).not.toBeDefined(); - - done(); - } catch (err) { - done(err); - } + response = await service.getCases(params); + expect(response).toBeDefined(); + expect(response.status).toEqual(200); + const { result } = response || {}; + + expect(result.total_count).toBeDefined(); + expect(result.first).toBeDefined(); + expect(result.last).toBeDefined(); + expect(result.cases).toBeDefined(); + + const testCase = result.cases[0]; + expect(testCase).toBeDefined(); + expect(testCase.number).toBeDefined(); + expect(testCase.short_description).toBeDefined(); + expect(testCase.severity).toBeDefined(); + expect(testCase.comments).not.toBeDefined(); }); - test('Failed to get cases with bad params', async (done) => { + test('Failed to get cases with bad params', async () => { params.fields = ['invalid_field']; try { @@ -190,11 +168,7 @@ describe('CaseManagementV1_integration', () => { } catch (err) { expect(err).toBeDefined(); expect(err.status).toEqual(400); - done(); - return; } - - done('Expected error response'); }); }); @@ -209,44 +183,32 @@ describe('CaseManagementV1_integration', () => { }; }); - test('Successfully got a case with default params', async (done) => { - try { - response = await service.getCase(params); - expect(response).toBeDefined(); - expect(response.status).toEqual(200); - const { result } = response || {}; + test('Successfully got a case with default params', async () => { + response = await service.getCase(params); + expect(response).toBeDefined(); + expect(response.status).toEqual(200); + const { result } = response || {}; - expect(result.number).toEqual(caseNumber); - - done(); - } catch (err) { - done(err); - } + expect(result.number).toEqual(caseNumber); }); - test('Successfully got a case with field filtering', async (done) => { + test('Successfully got a case with field filtering', async () => { params.fields = [ CaseManagementV1.GetCaseConstants.Fields.NUMBER, CaseManagementV1.GetCaseConstants.Fields.SEVERITY, ]; - try { - response = await service.getCase(params); - expect(response).toBeDefined(); - expect(response.status).toEqual(200); - const { result } = response || {}; - - expect(result.number).toEqual(caseNumber); - expect(result.severity).toBeDefined(); - expect(result.contact).not.toBeDefined(); + response = await service.getCase(params); + expect(response).toBeDefined(); + expect(response.status).toEqual(200); + const { result } = response || {}; - done(); - } catch (err) { - done(err); - } + expect(result.number).toEqual(caseNumber); + expect(result.severity).toBeDefined(); + expect(result.contact).not.toBeDefined(); }); - test('Failed to get a case with bad params', async (done) => { + test('Failed to get a case with bad params', async () => { params.fields = ['invalid_field']; try { @@ -254,11 +216,7 @@ describe('CaseManagementV1_integration', () => { } catch (err) { expect(err).toBeDefined(); expect(err.status).toEqual(400); - done(); - return; } - - done('Expected error response'); }); }); @@ -275,18 +233,13 @@ describe('CaseManagementV1_integration', () => { response = undefined; }); - test('Successfully added a comment to a case', async (done) => { - try { - response = await service.addComment(params); - expect(response).toBeDefined(); - expect(response.status).toEqual(200); + test('Successfully added a comment to a case', async () => { + response = await service.addComment(params); + expect(response).toBeDefined(); + expect(response.status).toEqual(200); - const { result } = response || {}; - expect(result.value).toEqual(commentValue); - done(); - } catch (err) { - done(err); - } + const { result } = response || {}; + expect(result.value).toEqual(commentValue); }); }); @@ -302,32 +255,21 @@ describe('CaseManagementV1_integration', () => { response = undefined; }); - test('Successfully added user to case watchlist', async (done) => { - try { - response = await service.addWatchlist(params); - expect(response).toBeDefined(); - expect(response.status).toEqual(200); + test('Successfully added user to case watchlist', async () => { + response = await service.addWatchlist(params); + expect(response).toBeDefined(); + expect(response.status).toEqual(200); - const { result } = response || {}; + const { result } = response || {}; - // We expect the call to fail because the fake user is not associated with the account. - expect(result.failed).toHaveLength(params.watchlist.length); - done(); - } catch (err) { - done(err); - } + // We expect the call to fail because the fake user is not associated with the account. + expect(result.failed).toHaveLength(params.watchlist.length); }); - test('Successfully removed users from case watchlist', async (done) => { - try { - response = await service.removeWatchlist(params); - expect(response).toBeDefined(); - expect(response.status).toEqual(200); - - done(); - } catch (err) { - done(err); - } + test('Successfully removed users from case watchlist', async () => { + response = await service.removeWatchlist(params); + expect(response).toBeDefined(); + expect(response.status).toEqual(200); }); }); @@ -335,7 +277,7 @@ describe('CaseManagementV1_integration', () => { let params; let response; - test('Succefully resolve a case', async (done) => { + test('Succefully resolve a case', async () => { params = { caseNumber, statusPayload: { @@ -345,21 +287,15 @@ describe('CaseManagementV1_integration', () => { }, }; - try { - response = await service.updateCaseStatus(params); - expect(response).toBeDefined(); - expect(response.status).toEqual(200); - - const { result } = response || {}; - expect(result.status).toEqual('Resolved'); + response = await service.updateCaseStatus(params); + expect(response).toBeDefined(); + expect(response.status).toEqual(200); - done(); - } catch (err) { - done(err); - } + const { result } = response || {}; + expect(result.status).toEqual('Resolved'); }); - test('Succefully unresolve a case', async (done) => { + test('Succefully unresolve a case', async () => { params = { caseNumber, statusPayload: { @@ -368,18 +304,12 @@ describe('CaseManagementV1_integration', () => { }, }; - try { - response = await service.updateCaseStatus(params); - expect(response).toBeDefined(); - expect(response.status).toEqual(200); - - const { result } = response || {}; - expect(result.status).toEqual('In Progress'); + response = await service.updateCaseStatus(params); + expect(response).toBeDefined(); + expect(response.status).toEqual(200); - done(); - } catch (err) { - done(err); - } + const { result } = response || {}; + expect(result.status).toEqual('In Progress'); }); }); @@ -391,63 +321,46 @@ describe('CaseManagementV1_integration', () => { response = undefined; }); - test('Successfully uploaded file', async (done) => { + test('Successfully uploaded file', async () => { params = { caseNumber, file: attachmentPayload, }; - try { - response = await service.uploadFile(params); - expect(response).toBeDefined(); - expect(response.status).toEqual(200); + response = await service.uploadFile(params); + expect(response).toBeDefined(); + expect(response.status).toEqual(200); - const { result } = response || {}; - expect(result.id).toBeDefined(); - expect(result.filename).toEqual(params.file.filename); + const { result } = response || {}; + expect(result.id).toBeDefined(); + expect(result.filename).toEqual(params.file.filename); - attachmentId = result.id; - done(); - } catch (err) { - done(err); - } + attachmentId = result.id; }); - test('Successfully downloaded a file', async (done) => { + test('Successfully downloaded a file', async () => { params = { caseNumber, fileId: attachmentId, }; - try { - response = await service.downloadFile(params); - expect(response).toBeDefined(); - expect(response.status).toEqual(200); - - const { result } = response || {}; - expect(result).toBeDefined(); + response = await service.downloadFile(params); + expect(response).toBeDefined(); + expect(response.status).toEqual(200); - done(); - } catch (err) { - done(err); - } + const { result } = response || {}; + expect(result).toBeDefined(); }); - test('Successfully deleted file', async (done) => { + test('Successfully deleted file', async () => { params = { caseNumber, fileId: attachmentId, }; - try { - response = await service.deleteFile(params); - expect(response).toBeDefined(); - expect(response.status).toEqual(200); - - done(); - } catch (err) { - done(err); - } + response = await service.deleteFile(params); + expect(response).toBeDefined(); + expect(response.status).toEqual(200); }); }); @@ -463,20 +376,14 @@ describe('CaseManagementV1_integration', () => { response = undefined; }); - test('Successfully added a resource', async (done) => { - try { - response = await service.addResource(params); + test('Successfully added a resource', async () => { + response = await service.addResource(params); - expect(response).toBeDefined(); - expect(response.status).toEqual(200); + expect(response).toBeDefined(); + expect(response.status).toEqual(200); - const { result } = response || {}; - expect(result.crn).toEqual(params.crn); - - done(); - } catch (err) { - done(err); - } + const { result } = response || {}; + expect(result.crn).toEqual(params.crn); }); }); }); diff --git a/test/integration/configuration-governance.v1.test.js b/test/integration/configuration-governance.v1.test.js index a1efded7..0a67f2f2 100644 --- a/test/integration/configuration-governance.v1.test.js +++ b/test/integration/configuration-governance.v1.test.js @@ -423,7 +423,7 @@ describe('ConfigurationGovernanceV1_integration', () => { }); }); - test('deleteRule', async (done) => { + test('deleteRule', async () => { expect(ruleId2).not.toBeNull(); expect(ruleId2).not.toBeUndefined(); @@ -449,7 +449,6 @@ describe('ConfigurationGovernanceV1_integration', () => { listRulesResp = await configurationGovernanceService.listRules(listRuleParams); } catch (err) { log(err); - done(err); } expect(deleteRuleResp).not.toBeNull(); @@ -465,7 +464,6 @@ describe('ConfigurationGovernanceV1_integration', () => { // Next, make sure we can not do a get on the deleted rule. const rule = await getRule(ruleId2); expect(rule).toBeNull(); - done(); }); test('deleteRuleInvalidRuleId', (done) => { @@ -487,7 +485,7 @@ describe('ConfigurationGovernanceV1_integration', () => { }); }); - test('createAttachment1', async (done) => { + test('createAttachment1', async () => { expect(ruleId1).not.toBeNull(); expect(ruleId1).not.toBeUndefined(); @@ -508,7 +506,6 @@ describe('ConfigurationGovernanceV1_integration', () => { createAttachmentsResp = await configurationGovernanceService.createAttachments(params); } catch (err) { log(err); - done(err); } expect(createAttachmentsResp).not.toBeNull(); @@ -527,10 +524,9 @@ describe('ConfigurationGovernanceV1_integration', () => { expect(rule).not.toBeNull(); expect(rule.number_of_attachments).not.toBeNull(); expect(rule.number_of_attachments).toEqual(1); - done(); }); - test('createAttachment2', async (done) => { + test('createAttachment2', async () => { expect(ruleId1).not.toBeNull(); expect(ruleId1).not.toBeUndefined(); @@ -550,7 +546,6 @@ describe('ConfigurationGovernanceV1_integration', () => { createAttachmentsResp = await configurationGovernanceService.createAttachments(params); } catch (err) { log(err); - done(err); } expect(createAttachmentsResp).not.toBeNull(); @@ -569,7 +564,6 @@ describe('ConfigurationGovernanceV1_integration', () => { expect(rule).not.toBeNull(); expect(rule.number_of_attachments).not.toBeNull(); expect(rule.number_of_attachments).toEqual(2); - done(); }); test('createAttachmentInvalidScopeType', (done) => { @@ -788,7 +782,7 @@ describe('ConfigurationGovernanceV1_integration', () => { }); }); - test('deleteAttachment', async (done) => { + test('deleteAttachment', async () => { expect(ruleId1).not.toBeNull(); expect(ruleId1).not.toBeUndefined(); @@ -819,7 +813,6 @@ describe('ConfigurationGovernanceV1_integration', () => { ); } catch (err) { log(err); - done(err); } expect(deleteAttachmentResp).not.toBeNull(); @@ -835,7 +828,6 @@ describe('ConfigurationGovernanceV1_integration', () => { // Next, make sure we cannot retrieve the deleted attachment via a get. const attachment = await getAttachment(ruleId1, attachmentId2); expect(attachment).toBeNull(); - done(); }); test('deleteAttachmentInvalidAttachmentId', (done) => { diff --git a/test/integration/context-based-restrictions.v1.test.js b/test/integration/context-based-restrictions.v1.test.js index 7d87362c..78f3a70d 100644 --- a/test/integration/context-based-restrictions.v1.test.js +++ b/test/integration/context-based-restrictions.v1.test.js @@ -369,7 +369,7 @@ describe('ContextBasedRestrictionsV1_integration', () => { }); }); - test('createRule() - 201 - Create a rule', async (done) => { + test('createRule() - 201 - Create a rule', async () => { const ruleContextAttributeModel = { name: 'networkZoneId', value: zoneId, @@ -413,7 +413,7 @@ describe('ContextBasedRestrictionsV1_integration', () => { try { res = await contextBasedRestrictionsService.createRule(params); } catch (err) { - done(err); + console.warn(err); } expect(res).toBeDefined(); @@ -422,8 +422,6 @@ describe('ContextBasedRestrictionsV1_integration', () => { ruleId = res.result.id; ruleEtag = res.headers.etag; - - done(); }); test('createRule() - 400 - Create a rule with "service not cbr enabled" error', async () => { diff --git a/test/integration/global-catalog.v1.test.js b/test/integration/global-catalog.v1.test.js index 1e11f96e..656e1081 100644 --- a/test/integration/global-catalog.v1.test.js +++ b/test/integration/global-catalog.v1.test.js @@ -127,23 +127,21 @@ describe('GlobalCatalogV1_integration', () => { service = GlobalCatalogV1.newInstance(); }); - beforeEach(async (done) => { + beforeEach(async () => { await service.deleteCatalogEntry(forceDelete); - done(); }); - afterEach(async (done) => { + afterEach(async () => { await service.deleteCatalogEntry(forceDelete); - done(); }); - test('Create catalog entry', async (done) => { + test('Create catalog entry', async () => { let response; try { response = await service.createCatalogEntry(defaultEntry); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -158,18 +156,16 @@ describe('GlobalCatalogV1_integration', () => { expect(result.disabled).toEqual(defaultEntry.disabled); expect(result.tags).toEqual(defaultEntry.tags); expect(result.provider).toEqual(defaultEntry.provider); - - done(); }); - test('Get catalog entry', async (done) => { + test('Get catalog entry', async () => { let response; try { await service.createCatalogEntry(defaultEntry); response = await service.getCatalogEntry(defaultEntry); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -185,18 +181,16 @@ describe('GlobalCatalogV1_integration', () => { expect(result.disabled).toEqual(defaultEntry.disabled); expect(result.tags).toEqual(defaultEntry.tags); expect(result.provider).toEqual(defaultEntry.provider); - - done(); }); - test('Update catalog entry', async (done) => { + test('Update catalog entry', async () => { let response; try { await service.createCatalogEntry(defaultEntry); response = await service.updateCatalogEntry(updatedEntry); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -212,18 +206,16 @@ describe('GlobalCatalogV1_integration', () => { expect(result.disabled).toEqual(updatedEntry.disabled); expect(result.tags).toEqual(updatedEntry.tags); expect(result.provider).toEqual(updatedEntry.provider); - - done(); }); - test('Delete catalog entry', async (done) => { + test('Delete catalog entry', async () => { let response; try { await service.createCatalogEntry(defaultEntry); response = await service.deleteCatalogEntry(forceDelete); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -231,29 +223,26 @@ describe('GlobalCatalogV1_integration', () => { const { result } = response || {}; expect(result).toBeDefined(); - - done(); }); - test('Fail to get catalog entry after deletion', async (done) => { + test('Fail to get catalog entry after deletion', async () => { expect.assertions(1); try { await service.createCatalogEntry(defaultEntry); await service.deleteCatalogEntry(forceDelete); } catch (err) { - done(err); + console.warn(err); } try { await service.getCatalogEntry(defaultEntry); } catch (err) { expect(err.status).toEqual(404); - done(); } }); - test('Fail to get catalog entry that does not exist', async (done) => { + test('Fail to get catalog entry that does not exist', async () => { expect.assertions(1); try { @@ -261,18 +250,17 @@ describe('GlobalCatalogV1_integration', () => { await service.getCatalogEntry(args); } catch (err) { expect(err.status).toEqual(404); - done(); } }); - test('Fail to delete catalog entry that does not exist', async (done) => { + test('Fail to delete catalog entry that does not exist', async () => { let response; try { const args = { 'id': 'bogus' }; response = await service.deleteCatalogEntry(args); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -280,45 +268,41 @@ describe('GlobalCatalogV1_integration', () => { const { result } = response || {}; expect(result).toBeDefined(); - - done(); }); - test('Fail to update catalog entry that does not exist', async (done) => { + test('Fail to update catalog entry that does not exist', async () => { expect.assertions(1); try { await service.getCatalogEntry(updatedEntry); } catch (err) { expect(err.status).toEqual(404); - done(); } }); - test('Fail to create catalog entry that already exists', async (done) => { + test('Fail to create catalog entry that already exists', async () => { expect.assertions(1); try { await service.createCatalogEntry(defaultEntry); } catch (err) { - done(err); + console.warn(err); } try { await service.createCatalogEntry(defaultEntry); } catch (err) { expect(err.status).toEqual(409); - done(); } }); - test('List catalog entry', async (done) => { + test('List catalog entry', async () => { let response; try { response = await service.listCatalogEntries(); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -330,11 +314,9 @@ describe('GlobalCatalogV1_integration', () => { const { resources } = result || {}; expect(resources).toBeDefined(); expect(resources.length).toBeGreaterThan(0); - - done(); }); - test('Get child catalog entry', async (done) => { + test('Get child catalog entry', async () => { let response; try { @@ -342,7 +324,7 @@ describe('GlobalCatalogV1_integration', () => { await service.createCatalogEntry(defaultChildEntry); response = await service.getChildObjects(defaultEntry); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -366,22 +348,19 @@ describe('GlobalCatalogV1_integration', () => { expect(resources[0].disabled).toEqual(defaultChildEntry.disabled); expect(resources[0].tags).toEqual(defaultChildEntry.tags); expect(resources[0].provider).toEqual(defaultChildEntry.provider); - - done(); }); - test('Fail to get child catalog entry that does not exist', async (done) => { + test('Fail to get child catalog entry that does not exist', async () => { expect.assertions(1); try { const args = { 'id': 'bogus', 'kind': 'bogus' }; await service.getChildObjects(args); } catch (err) { expect(err.status).toEqual(404); - done(); } }); - test('Restore catalog entry', async (done) => { + test('Restore catalog entry', async () => { let response; try { @@ -389,7 +368,7 @@ describe('GlobalCatalogV1_integration', () => { await service.deleteCatalogEntry(defaultEntry); response = await service.restoreCatalogEntry(defaultEntry); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -398,7 +377,7 @@ describe('GlobalCatalogV1_integration', () => { try { response = await service.getCatalogEntry(defaultEntry); } catch (err) { - done(err); + console.log(err); } expect(response).toBeDefined(); @@ -414,11 +393,9 @@ describe('GlobalCatalogV1_integration', () => { expect(result.disabled).toEqual(defaultEntry.disabled); expect(result.tags).toEqual(defaultEntry.tags); expect(result.provider).toEqual(defaultEntry.provider); - - done(); }); - test('Fail to restore catalog entry that does not exist', async (done) => { + test('Fail to restore catalog entry that does not exist', async () => { expect.assertions(1); try { @@ -426,18 +403,17 @@ describe('GlobalCatalogV1_integration', () => { await service.getCatalogEntry(args); } catch (err) { expect(err.status).toEqual(404); - done(); } }); - test('Get catalog entry visibility', async (done) => { + test('Get catalog entry visibility', async () => { let response; try { await service.createCatalogEntry(defaultEntry); response = await service.getVisibility(defaultEntry); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -446,39 +422,35 @@ describe('GlobalCatalogV1_integration', () => { const { result } = response || {}; expect(result).toBeDefined(); expect(result.restrictions).toEqual(defaultEntry.restrictions); - - done(); }); - test('Fail to get visibility for catalog entry that does not exist', async (done) => { + test('Fail to get visibility for catalog entry that does not exist', async () => { expect.assertions(1); try { const args = { 'id': 'bogus' }; await service.getVisibility(args); } catch (err) { expect(err.status).toEqual(404); - done(); } }); - test('Update catalog entry visibility', async (done) => { + test('Update catalog entry visibility', async () => { expect.assertions(1); try { await service.createCatalogEntry(defaultEntry); } catch (err) { - done(err); + console.warn(err); } try { await service.updateVisibility(defaultEntry); } catch (err) { expect(err.status).toEqual(403); - done(); } }); - test('Fail to update visibility for catalog entry that does not exist', async (done) => { + test('Fail to update visibility for catalog entry that does not exist', async () => { expect.assertions(1); try { @@ -486,24 +458,22 @@ describe('GlobalCatalogV1_integration', () => { await service.updateVisibility(args); } catch (err) { expect(err.status).toEqual(404); - done(); } }); - test('Fail to get catalog entry pricing', async (done) => { + test('Fail to get catalog entry pricing', async () => { expect.assertions(1); try { await service.createCatalogEntry(defaultEntry); } catch (err) { - done(err); + console.warn(err); } try { await service.getPricing(defaultEntry); } catch (err) { expect(err.status).toEqual(404); - done(); } try { @@ -511,11 +481,10 @@ describe('GlobalCatalogV1_integration', () => { await service.getPricing(args); } catch (err) { expect(err.status).toEqual(404); - done(); } }); - test('List catalog entry artifacts', async (done) => { + test('List catalog entry artifacts', async () => { let response; const args = { @@ -531,7 +500,7 @@ describe('GlobalCatalogV1_integration', () => { await service.uploadArtifact(args); response = await service.listArtifacts(args); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -549,18 +518,16 @@ describe('GlobalCatalogV1_integration', () => { `${service.baseOptions.serviceUrl}/${defaultEntry.id}/artifacts/${defaultEntry.artifactId}` ); expect(resources[0].size).toEqual(23); - - done(); }); - test('Fail to list catalog entry artifacts', async (done) => { + test('Fail to list catalog entry artifacts', async () => { let response; try { const args = { 'objectId': 'bogus' }; response = await service.listArtifacts(args); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -569,11 +536,9 @@ describe('GlobalCatalogV1_integration', () => { const { result } = response || {}; expect(result).toBeDefined(); expect(result.count).toEqual(0); - - done(); }); - test('Get catalog entry artifact', async (done) => { + test('Get catalog entry artifact', async () => { let response; const args = { @@ -589,7 +554,7 @@ describe('GlobalCatalogV1_integration', () => { await service.uploadArtifact(args); response = await service.getArtifact(args); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -598,17 +563,15 @@ describe('GlobalCatalogV1_integration', () => { const { result } = response || {}; expect(result).toBeDefined(); // expect(JSON.parse(result.read().toString())).toEqual(defaultEntry.artifact); - - done(); }); - test('Fail to get catalog entry artifact', async (done) => { + test('Fail to get catalog entry artifact', async () => { expect.assertions(2); try { await service.createCatalogEntry(defaultEntry); } catch (err) { - done(err); + console.log(err); } try { @@ -616,7 +579,6 @@ describe('GlobalCatalogV1_integration', () => { await service.getArtifact(args); } catch (err) { expect(err.status).toEqual(404); - done(); } try { @@ -624,11 +586,10 @@ describe('GlobalCatalogV1_integration', () => { await service.getArtifact(args); } catch (err) { expect(err.status).toEqual(404); - done(); } }); - test('Create catalog entry artifact', async (done) => { + test('Create catalog entry artifact', async () => { let response; const args = { @@ -643,7 +604,7 @@ describe('GlobalCatalogV1_integration', () => { await service.createCatalogEntry(defaultEntry); response = await service.uploadArtifact(args); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -651,11 +612,9 @@ describe('GlobalCatalogV1_integration', () => { const { result } = response || {}; expect(result).toBeDefined(); - - done(); }); - test('Fail to create catalog entry artifact', async (done) => { + test('Fail to create catalog entry artifact', async () => { expect.assertions(1); const args = { @@ -670,11 +629,10 @@ describe('GlobalCatalogV1_integration', () => { await service.uploadArtifact(args); } catch (err) { expect(err.status).toEqual(404); - done(); } }); - test('Delete catalog entry artifact', async (done) => { + test('Delete catalog entry artifact', async () => { let response; const args = { @@ -690,7 +648,7 @@ describe('GlobalCatalogV1_integration', () => { await service.uploadArtifact(args); response = await service.deleteArtifact(args); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -698,11 +656,9 @@ describe('GlobalCatalogV1_integration', () => { const { result } = response || {}; expect(result).toBeDefined(); - - done(); }); - test('Fail to delete catalog entry artifact', async (done) => { + test('Fail to delete catalog entry artifact', async () => { expect.assertions(1); try { @@ -710,7 +666,6 @@ describe('GlobalCatalogV1_integration', () => { await service.deleteArtifact(args); } catch (err) { expect(err.status).toEqual(404); - done(); } }); }); diff --git a/test/integration/iam-access-groups.v2.test.js b/test/integration/iam-access-groups.v2.test.js index 94c42c49..68f7ccb4 100644 --- a/test/integration/iam-access-groups.v2.test.js +++ b/test/integration/iam-access-groups.v2.test.js @@ -63,7 +63,7 @@ describe('IamAccessGroupsV2_integration', () => { done(); }); - test('Create an access group', async (done) => { + test('Create an access group', async () => { const params = { accountId: testAccountId, name: testGroupName, @@ -73,7 +73,7 @@ describe('IamAccessGroupsV2_integration', () => { try { response = await service.createAccessGroup(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -84,11 +84,9 @@ describe('IamAccessGroupsV2_integration', () => { expect(result.name).toEqual(testGroupName); testGroupId = result.id; - - done(); }); - test('Get an access group', async (done) => { + test('Get an access group', async () => { expect(testGroupId).toBeDefined(); const params = { @@ -99,7 +97,7 @@ describe('IamAccessGroupsV2_integration', () => { try { response = await service.getAccessGroup(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -112,11 +110,9 @@ describe('IamAccessGroupsV2_integration', () => { expect(result.description).toEqual(''); testGroupETag = response.headers.etag; - - done(); }); - test('Update an access group', async (done) => { + test('Update an access group', async () => { expect(testGroupId).toBeDefined(); expect(testGroupETag).toBeDefined(); @@ -130,7 +126,7 @@ describe('IamAccessGroupsV2_integration', () => { try { response = await service.updateAccessGroup(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -141,11 +137,9 @@ describe('IamAccessGroupsV2_integration', () => { expect(result.id).toEqual(testGroupId); expect(result.name).toEqual(testGroupName); expect(result.description).toEqual(testGroupDescription); - - done(); }); - test('List access groups', async (done) => { + test('List access groups', async () => { expect(testGroupId).toBeDefined(); const params = { @@ -157,7 +151,7 @@ describe('IamAccessGroupsV2_integration', () => { try { response = await service.listAccessGroups(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -175,11 +169,9 @@ describe('IamAccessGroupsV2_integration', () => { } } expect(foundTestGroup).toBeTruthy(); - - done(); }); - test('Add members to an access group', async (done) => { + test('Add members to an access group', async () => { expect(testGroupId).toBeDefined(); const params = { @@ -196,7 +188,7 @@ describe('IamAccessGroupsV2_integration', () => { try { response = await service.addMembersToAccessGroup(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -216,11 +208,9 @@ describe('IamAccessGroupsV2_integration', () => { } } expect(foundTestUser).toBeTruthy(); - - done(); }); - test('Add member to multiple access groups', async (done) => { + test('Add member to multiple access groups', async () => { expect(testGroupId).toBeDefined(); const params = { @@ -234,7 +224,7 @@ describe('IamAccessGroupsV2_integration', () => { try { response = await service.addMemberToMultipleAccessGroups(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -253,11 +243,9 @@ describe('IamAccessGroupsV2_integration', () => { } } expect(foundTestGroup).toBeTruthy(); - - done(); }); - test('Check access group membership', async (done) => { + test('Check access group membership', async () => { expect(testGroupId).toBeDefined(); const params = { @@ -269,16 +257,14 @@ describe('IamAccessGroupsV2_integration', () => { try { response = await service.isMemberOfAccessGroup(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); expect(response.status).toEqual(204); - - done(); }); - test('List access group memberships', async (done) => { + test('List access group memberships', async () => { expect(testGroupId).toBeDefined(); const params = { @@ -289,7 +275,7 @@ describe('IamAccessGroupsV2_integration', () => { try { response = await service.listAccessGroupMembers(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -307,11 +293,9 @@ describe('IamAccessGroupsV2_integration', () => { } } expect(foundTestUser).toBeTruthy(); - - done(); }); - test('Delete access group membership', async (done) => { + test('Delete access group membership', async () => { expect(testGroupId).toBeDefined(); const params = { @@ -323,16 +307,14 @@ describe('IamAccessGroupsV2_integration', () => { try { response = await service.removeMemberFromAccessGroup(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); expect(response.status).toEqual(204); - - done(); }); - test('Delete member from all groups', async (done) => { + test('Delete member from all groups', async () => { expect(testGroupId).toBeDefined(); const params = { @@ -345,11 +327,10 @@ describe('IamAccessGroupsV2_integration', () => { } catch (err) { expect(err.status).toEqual(404); expect(err.message).toContain(testUserId); - done(); } }); - test('Delete multiple members from an access group', async (done) => { + test('Delete multiple members from an access group', async () => { expect(testGroupId).toBeDefined(); const params = { @@ -362,11 +343,10 @@ describe('IamAccessGroupsV2_integration', () => { } catch (err) { expect(err.status).toEqual(404); expect(err.message).toContain(testGroupId); - done(); } }); - test('Create an access group rule', async (done) => { + test('Create an access group rule', async () => { expect(testGroupId).toBeDefined(); const testExpiration = 24; @@ -388,7 +368,7 @@ describe('IamAccessGroupsV2_integration', () => { try { response = await service.addAccessGroupRule(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -400,11 +380,9 @@ describe('IamAccessGroupsV2_integration', () => { expect(result.expiration).toEqual(testExpiration); testClaimRuleId = result.id; - - done(); }); - test('Get an access group rule', async (done) => { + test('Get an access group rule', async () => { expect(testGroupId).toBeDefined(); expect(testClaimRuleId).toBeDefined(); @@ -417,7 +395,7 @@ describe('IamAccessGroupsV2_integration', () => { try { response = await service.getAccessGroupRule(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -429,11 +407,9 @@ describe('IamAccessGroupsV2_integration', () => { expect(result.id).toEqual(testClaimRuleId); testClaimRuleETag = response.headers.etag; - - done(); }); - test('List access group rules', async (done) => { + test('List access group rules', async () => { expect(testGroupId).toBeDefined(); const params = { @@ -444,7 +420,7 @@ describe('IamAccessGroupsV2_integration', () => { try { response = await service.listAccessGroupRules(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -462,11 +438,9 @@ describe('IamAccessGroupsV2_integration', () => { } } expect(foundTestClaimRule).toBeTruthy(); - - done(); }); - test('Update an access group rule', async (done) => { + test('Update an access group rule', async () => { expect(testGroupId).toBeDefined(); expect(testClaimRuleId).toBeDefined(); @@ -491,7 +465,7 @@ describe('IamAccessGroupsV2_integration', () => { try { response = await service.replaceAccessGroupRule(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -501,11 +475,9 @@ describe('IamAccessGroupsV2_integration', () => { expect(result.account_id).toEqual(testAccountId); expect(result.access_group_id).toEqual(testGroupId); expect(result.id).toEqual(testClaimRuleId); - - done(); }); - test('Delete an access group rule', async (done) => { + test('Delete an access group rule', async () => { expect(testGroupId).toBeDefined(); expect(testClaimRuleId).toBeDefined(); @@ -518,16 +490,14 @@ describe('IamAccessGroupsV2_integration', () => { try { response = await service.removeAccessGroupRule(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); expect(response.status).toEqual(204); - - done(); }); - test('Get account settings', async (done) => { + test('Get account settings', async () => { const params = { accountId: testAccountId, }; @@ -536,7 +506,7 @@ describe('IamAccessGroupsV2_integration', () => { try { response = await service.getAccountSettings(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -546,11 +516,9 @@ describe('IamAccessGroupsV2_integration', () => { expect(result.account_id).toEqual(testAccountId); testAccountSettings = result; - - done(); }); - test('Update account settings', async (done) => { + test('Update account settings', async () => { const params = { accountId: testAccountId, publicAccessEnabled: testAccountSettings.public_access_enabled, @@ -560,7 +528,7 @@ describe('IamAccessGroupsV2_integration', () => { try { response = await service.updateAccountSettings(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -569,11 +537,9 @@ describe('IamAccessGroupsV2_integration', () => { expect(result).toBeDefined(); expect(result.account_id).toEqual(testAccountId); expect(result.public_access_enabled).toEqual(testAccountSettings.public_access_enabled); - - done(); }); - test('Clean up all test groups', async (done) => { + test('Clean up all test groups', async () => { // List all groups in the account (minus the public access group) const params = { accountId: testAccountId, @@ -584,7 +550,7 @@ describe('IamAccessGroupsV2_integration', () => { try { response = await service.listAccessGroups(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -611,7 +577,7 @@ describe('IamAccessGroupsV2_integration', () => { try { response = await service.deleteAccessGroup(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -619,7 +585,5 @@ describe('IamAccessGroupsV2_integration', () => { } } } - - done(); }); }); diff --git a/test/integration/iam-identity.v1.test.js b/test/integration/iam-identity.v1.test.js index 13e2a2d7..cdf83beb 100644 --- a/test/integration/iam-identity.v1.test.js +++ b/test/integration/iam-identity.v1.test.js @@ -212,7 +212,7 @@ describe('IamIdentityV1_integration', () => { }); }); - test('listApiKeys()', async (done) => { + test('listApiKeys()', async () => { const pageSize = 1; let pageToken = null; const apikeys = []; @@ -244,12 +244,10 @@ describe('IamIdentityV1_integration', () => { } while (pageToken != null); } catch (err) { console.log(err); - done(err); } // Make sure we found the two apikeys that we created previously. expect(apikeys).toHaveLength(2); - done(); }); test('updateApiKey()', (done) => { @@ -283,7 +281,7 @@ describe('IamIdentityV1_integration', () => { }); }); - test('lockApiKey()', async (done) => { + test('lockApiKey()', (done) => { expect(apikeyId2).toBeDefined(); expect(apikeyId2).not.toBeNull(); const params = { @@ -307,7 +305,7 @@ describe('IamIdentityV1_integration', () => { }); }); - test('unlockApiKey()', async (done) => { + test('unlockApiKey()', (done) => { expect(apikeyId2).toBeDefined(); expect(apikeyId2).not.toBeNull(); const params = { @@ -331,7 +329,7 @@ describe('IamIdentityV1_integration', () => { }); }); - test('deleteApiKey1()', async (done) => { + test('deleteApiKey1()', (done) => { expect(apikeyId1).toBeDefined(); expect(apikeyId1).not.toBeNull(); const params = { @@ -356,7 +354,7 @@ describe('IamIdentityV1_integration', () => { }); }); - test('deleteApiKey2()', async (done) => { + test('deleteApiKey2()', (done) => { expect(apikeyId2).toBeDefined(); expect(apikeyId2).not.toBeNull(); const params = { @@ -545,7 +543,7 @@ describe('IamIdentityV1_integration', () => { }); }); - test('deleteServiceId()', async (done) => { + test('deleteServiceId()', (done) => { expect(serviceId1).toBeDefined(); expect(serviceId1).not.toBeNull(); const params = { @@ -654,7 +652,7 @@ describe('IamIdentityV1_integration', () => { }); }); - test('listProfiles()', async (done) => { + test('listProfiles()', async () => { const pageSize = 1; let pageToken = null; const profiles = []; @@ -683,11 +681,9 @@ describe('IamIdentityV1_integration', () => { } while (pageToken != null); } catch (err) { console.log(err); - done(err); } expect(profiles).toHaveLength(2); - done(); }); test('updateProfile()', (done) => { @@ -720,7 +716,7 @@ describe('IamIdentityV1_integration', () => { }); }); - test('deleteProfile1()', async (done) => { + test('deleteProfile1()', (done) => { expect(profileId1).toBeDefined(); expect(profileId1).not.toBeNull(); const params = { @@ -848,7 +844,7 @@ describe('IamIdentityV1_integration', () => { }); }); - test('listClaimRules()', async (done) => { + test('listClaimRules()', async () => { const claimRules = []; const params = { profileId: profileId2, @@ -865,7 +861,6 @@ describe('IamIdentityV1_integration', () => { } } expect(claimRules).toHaveLength(2); - done(); }); test('updateClaimRule()', (done) => { @@ -910,7 +905,7 @@ describe('IamIdentityV1_integration', () => { }); }); - test('deleteClaimRule1()', async (done) => { + test('deleteClaimRule1()', (done) => { expect(claimRuleId1).toBeDefined(); expect(claimRuleId1).not.toBeNull(); const params = { @@ -997,7 +992,7 @@ describe('IamIdentityV1_integration', () => { }); }); - test('listLinks()', async (done) => { + test('listLinks()', async () => { const links = []; const params = { profileId: profileId2, @@ -1014,10 +1009,9 @@ describe('IamIdentityV1_integration', () => { } } expect(links).toHaveLength(1); - done(); }); - test('deleteLink()', async (done) => { + test('deleteLink()', (done) => { expect(linkId).toBeDefined(); expect(linkId).not.toBeNull(); const params = { @@ -1042,7 +1036,7 @@ describe('IamIdentityV1_integration', () => { }); }); - test('deleteClaimRule2()', async (done) => { + test('deleteClaimRule2()', (done) => { expect(claimRuleId2).toBeDefined(); expect(claimRuleId2).not.toBeNull(); const params = { @@ -1067,7 +1061,7 @@ describe('IamIdentityV1_integration', () => { }); }); - test('deleteProfile2()', async (done) => { + test('deleteProfile2()', (done) => { expect(profileId2).toBeDefined(); expect(profileId2).not.toBeNull(); const params = { diff --git a/test/integration/open-service-broker.v1.test.js b/test/integration/open-service-broker.v1.test.js index 5b54d22f..34fbb608 100644 --- a/test/integration/open-service-broker.v1.test.js +++ b/test/integration/open-service-broker.v1.test.js @@ -61,7 +61,7 @@ describe('OpenServiceBrokerV1_integration', () => { done(); }); - test('00 - Create A Service Instance', async (done) => { + test('00 - Create A Service Instance', async () => { const customHeader = { 'Transaction-Id': `osb-sdk-node-test00-${transactionId}`, }; @@ -90,7 +90,7 @@ describe('OpenServiceBrokerV1_integration', () => { try { response = await service.replaceServiceInstance(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -99,11 +99,9 @@ describe('OpenServiceBrokerV1_integration', () => { const { result } = response; expect(result.dashboard_url).toBeDefined(); - - done(); }); - test('01 - Update Service Instance', async (done) => { + test('01 - Update Service Instance', async () => { const customHeader = { 'Transaction-Id': `osb-sdk-node-test01-${transactionId}`, }; @@ -132,7 +130,7 @@ describe('OpenServiceBrokerV1_integration', () => { try { response = await service.updateServiceInstance(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -142,11 +140,9 @@ describe('OpenServiceBrokerV1_integration', () => { const { result } = response; expect(result.service_instance_id).toEqual(testInstanceId); expect(result.plan_id).toEqual(testPlanId1); - - done(); }); - test('02 - Disable Service Instance State', async (done) => { + test('02 - Disable Service Instance State', async () => { const customHeader = { 'Transaction-Id': `osb-sdk-node-test02-${transactionId}`, }; @@ -163,7 +159,7 @@ describe('OpenServiceBrokerV1_integration', () => { try { response = await service.replaceServiceInstanceState(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -173,11 +169,9 @@ describe('OpenServiceBrokerV1_integration', () => { const { result } = response; expect(result.active).toBeDefined(); expect(result.enabled).toBeDefined(); - - done(); }); - test('03 - Enable Service Instance State', async (done) => { + test('03 - Enable Service Instance State', async () => { const customHeader = { 'Transaction-Id': `osb-sdk-node-test03-${transactionId}`, }; @@ -194,7 +188,7 @@ describe('OpenServiceBrokerV1_integration', () => { try { response = await service.replaceServiceInstanceState(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -204,11 +198,9 @@ describe('OpenServiceBrokerV1_integration', () => { const { result } = response; expect(result.active).toBeDefined(); expect(result.enabled).toBeDefined(); - - done(); }); - test('04 - Bind Service Instance', async (done) => { + test('04 - Bind Service Instance', async () => { const customHeader = { 'Transaction-Id': `osb-sdk-node-test04-${transactionId}`, }; @@ -232,7 +224,7 @@ describe('OpenServiceBrokerV1_integration', () => { try { response = await service.replaceServiceBinding(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -241,10 +233,9 @@ describe('OpenServiceBrokerV1_integration', () => { const { result } = response; expect(result.credentials).toBeDefined(); - done(); }); - test('05 - Get Service Instance State', async (done) => { + test('05 - Get Service Instance State', async () => { const customHeader = { 'Transaction-Id': `osb-sdk-node-test05-${transactionId}`, }; @@ -258,7 +249,7 @@ describe('OpenServiceBrokerV1_integration', () => { try { response = await service.getServiceInstanceState(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -269,10 +260,9 @@ describe('OpenServiceBrokerV1_integration', () => { console.log(`Result-defined!: ${JSON.stringify(result)}`); expect(result.active).toBeDefined(); expect(result.enabled).toBeDefined(); - done(); }); - test('06 - Get Catalog Metadata', async (done) => { + test('06 - Get Catalog Metadata', async () => { const customHeader = { 'Transaction-Id': `osb-sdk-node-test06-${transactionId}`, }; @@ -285,7 +275,7 @@ describe('OpenServiceBrokerV1_integration', () => { try { response = await service.listCatalog(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); @@ -297,11 +287,9 @@ describe('OpenServiceBrokerV1_integration', () => { expect(result.services[0].name).toBeDefined(); expect(result.services[0].bindable).toBeDefined(); expect(result.services[0].plan_updateable).toBeDefined(); - - done(); }); - test('07 - Delete Service Binding', async (done) => { + test('07 - Delete Service Binding', async () => { const customHeader = { 'Transaction-Id': `osb-sdk-node-test07-${transactionId}`, }; @@ -318,15 +306,14 @@ describe('OpenServiceBrokerV1_integration', () => { try { response = await service.deleteServiceBinding(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); expect(response.status).toEqual(200); - done(); }); - test('08 - Delete Service Instance', async (done) => { + test('08 - Delete Service Instance', async () => { const customHeader = { 'Transaction-Id': `osb-sdk-node-test08-${transactionId}`, }; @@ -342,12 +329,11 @@ describe('OpenServiceBrokerV1_integration', () => { try { response = await service.deleteServiceInstance(params); } catch (err) { - done(err); + console.warn(err); } expect(response).toBeDefined(); expect(response.status).toEqual(200); expect(response.result).toBeDefined(); - done(); }); }); diff --git a/test/integration/resource-controller.v2.test.js b/test/integration/resource-controller.v2.test.js index 1ead26bc..3f51b63c 100644 --- a/test/integration/resource-controller.v2.test.js +++ b/test/integration/resource-controller.v2.test.js @@ -1869,8 +1869,8 @@ describe('ResourceControllerV2_integration', () => { // done(); // }); - afterAll(() => { - cleanUp(); + afterAll(async () => { + await cleanUp(); }, 120000); async function cleanUp() { diff --git a/test/integration/usage-reports.v4.test.js b/test/integration/usage-reports.v4.test.js index 82114849..07598124 100644 --- a/test/integration/usage-reports.v4.test.js +++ b/test/integration/usage-reports.v4.test.js @@ -168,7 +168,7 @@ describe('UsageReportsV4_integration', () => { done(err); }); }); - test('getResourceUsageAccount()', async (done) => { + test('getResourceUsageAccount()', async () => { const resources = []; let offset = null; @@ -202,16 +202,14 @@ describe('UsageReportsV4_integration', () => { } while (offset != null); } catch (err) { console.log(err); - done(err); } // Make sure we found some resources. const numResources = resources.length; // console.log(`getResourceUsageAccount() response contained ${numResources} total resources`); expect(numResources).toBeGreaterThan(0); - done(); }); - test('getResourceUsageResourceGroup()', async (done) => { + test('getResourceUsageResourceGroup()', async () => { const resources = []; let offset = null; @@ -246,16 +244,14 @@ describe('UsageReportsV4_integration', () => { } while (offset != null); } catch (err) { console.log(err); - done(err); } // Make sure we found some resources. const numResources = resources.length; // console.log(`getResourceUsageResourceGroup() response contained ${numResources} total resources`); expect(numResources).toBeGreaterThan(0); - done(); }); - test('getResourceUsageOrg()', async (done) => { + test('getResourceUsageOrg()', async () => { const resources = []; let offset = null; @@ -290,13 +286,11 @@ describe('UsageReportsV4_integration', () => { } while (offset != null); } catch (err) { console.log(err); - done(err); } // Make sure we found some resources. const numResources = resources.length; // console.log(`getResourceUsageOrg() response contained ${numResources} total resources`); expect(numResources).toBeGreaterThan(0); - done(); }); }); diff --git a/test/integration/user-management.v1.test.js b/test/integration/user-management.v1.test.js index 8c750712..7b33b60b 100644 --- a/test/integration/user-management.v1.test.js +++ b/test/integration/user-management.v1.test.js @@ -116,7 +116,7 @@ describe('UserManagementV1_integration', () => { done(err); }); }); - test('listUsers()', async (done) => { + test('listUsers()', async () => { const results = []; let start = null; @@ -149,14 +149,12 @@ describe('UserManagementV1_integration', () => { } while (start != null); } catch (err) { console.log(err); - done(err); } // Make sure we found some users. const numUsers = results.length; console.log(`listUsers() response contained ${numUsers} total users`); expect(numUsers).toBeGreaterThan(0); - done(); }); test('inviteUsers()', (done) => { // Request models needed by this operation.