Azure / ng-deploy-azure

Deploy Angular apps to Azure using the Angular CLI
MIT License
79 stars 37 forks source link

fixing broken test #15

Closed softchris closed 5 years ago

softchris commented 5 years ago

Pull Request Template

Description

Fixed so that

Type of change

Please delete options that are not relevant.

Closing issues

Put closes #XXXX in your comment to auto-close the issue that your PR fixes (if such).

Assignee

Please add yourself as the assignee

Projects

Please add relevant projects so this issue can be properly tracked.

johnpapa commented 5 years ago

Tests fail. Details below.

 PASS  src/util/azure/__tests__/locations.ts
- Fetching resource groups
- Fetching resource groups
 FAIL  src/util/azure/__tests__/resource-group.js
  ● resource group › should create resource group

    credentials argument needs to implement signRequest method

      16 | 
      17 | export async function getResourceGroups(creds: DeviceTokenCredentials, subscription: string) {
    > 18 |   const client = new ResourceManagementClient(creds, subscription);
         |                  ^
      19 |   const resourceGroupList = await client.resourceGroups.list() as ResourceGroupDetails[];
      20 |   return resourceGroupList;
      21 | }

      at ResourceManagementClient.ServiceClient (node_modules/@azure/ms-rest-js/lib/serviceClient.ts:143:13)
      at ResourceManagementClient.AzureServiceClient [as constructor] (node_modules/@azure/ms-rest-azure-js/lib/azureServiceClient.ts:42:5)
      at ResourceManagementClientContext [as constructor] (node_modules/@azure/arm-resources/lib/resourceManagementClientContext.ts:45:5)
      at new ResourceManagementClient (node_modules/@azure/arm-resources/lib/resourceManagementClient.ts:35:5)
      at Object.<anonymous> (src/util/azure/resource-group-helper.ts:18:18)
      at src/util/azure/resource-group-helper.js:7:71
      at Object.<anonymous>.__awaiter (src/util/azure/resource-group-helper.js:3:12)
      at Object.getResourceGroups (src/util/azure/resource-group-helper.js:17:12)
      at Object.<anonymous> (src/util/azure/resource-group.ts:49:37)
      at src/util/azure/resource-group.js:7:71
      at Object.<anonymous>.__awaiter (src/util/azure/resource-group.js:3:12)
      at Object.getResourceGroup (src/util/azure/resource-group.js:35:12)
      at Object.<anonymous> (src/util/azure/__tests__/resource-group.ts:34:47)
      at src/util/azure/__tests__/resource-group.js:7:71
      at Object.<anonymous>.__awaiter (src/util/azure/__tests__/resource-group.js:3:12)
      at Object.test (src/util/azure/__tests__/resource-group.ts:32:50)

  ● resource group › should use existing resource group and return it

    credentials argument needs to implement signRequest method

      16 | 
      17 | export async function getResourceGroups(creds: DeviceTokenCredentials, subscription: string) {
    > 18 |   const client = new ResourceManagementClient(creds, subscription);
         |                  ^
      19 |   const resourceGroupList = await client.resourceGroups.list() as ResourceGroupDetails[];
      20 |   return resourceGroupList;
      21 | }

      at ResourceManagementClient.ServiceClient (node_modules/@azure/ms-rest-js/lib/serviceClient.ts:143:13)
      at ResourceManagementClient.AzureServiceClient [as constructor] (node_modules/@azure/ms-rest-azure-js/lib/azureServiceClient.ts:42:5)
      at ResourceManagementClientContext [as constructor] (node_modules/@azure/arm-resources/lib/resourceManagementClientContext.ts:45:5)
      at new ResourceManagementClient (node_modules/@azure/arm-resources/lib/resourceManagementClient.ts:35:5)
      at Object.<anonymous> (src/util/azure/resource-group-helper.ts:18:18)
      at src/util/azure/resource-group-helper.js:7:71
      at Object.<anonymous>.__awaiter (src/util/azure/resource-group-helper.js:3:12)
      at Object.getResourceGroups (src/util/azure/resource-group-helper.js:17:12)
      at Object.<anonymous> (src/util/azure/resource-group.ts:49:37)
      at src/util/azure/resource-group.js:7:71
      at Object.<anonymous>.__awaiter (src/util/azure/resource-group.js:3:12)
      at Object.getResourceGroup (src/util/azure/resource-group.js:35:12)
      at Object.<anonymous> (src/util/azure/__tests__/resource-group.ts:47:48)
      at src/util/azure/__tests__/resource-group.js:7:71
      at Object.<anonymous>.__awaiter (src/util/azure/__tests__/resource-group.js:3:12)
      at Object.test (src/util/azure/__tests__/resource-group.ts:42:70)

 PASS  src/util/azure/__tests__/subscription.ts
 PASS  src/util/azure/__tests__/locations.js
 FAIL  src/util/azure/__tests__/resource-group.ts
  ● resource group › should create resource group

    TypeError: createResourceGroupMock.mockClear is not a function

      32 |   beforeEach(() => {
      33 |     logger.info.mockClear();
    > 34 |     createResourceGroupMock.mockClear();
         |                             ^
      35 |   });
      36 | 
      37 |   test.only('should create resource group', async() => {

      at Object.beforeEach (src/util/azure/__tests__/resource-group.ts:34:29)

  ● resource group › should create resource group

    TypeError: Cannot read property 'calls' of undefined

      39 |     await getResourceGroup(credentials, subscription, options, logger);
      40 | 
    > 41 |     expect(createResourceGroupMock.mock.calls[0][0]).toBe(RESOURCE_GROUP);
         |                                         ^
      42 |   });
      43 | 
      44 |   test('should use existing resource group and return it', async() => {

      at Object.<anonymous> (src/util/azure/__tests__/resource-group.ts:41:41)
      at fulfilled (src/util/azure/__tests__/resource-group.ts:4:58)

 PASS  src/util/azure/__tests__/subscription.js
 FAIL  src/util/azure/__tests__/locations.d.ts
  ● Test suite failed to run

    Your test suite must contain at least one test.

      at node_modules/@jest/core/build/TestScheduler.js:242:24
      at asyncGeneratorStep (node_modules/@jest/core/build/TestScheduler.js:131:24)
      at _next (node_modules/@jest/core/build/TestScheduler.js:151:9)
      at node_modules/@jest/core/build/TestScheduler.js:156:7
      at node_modules/@jest/core/build/TestScheduler.js:148:12
      at onResult (node_modules/@jest/core/build/TestScheduler.js:271:25)

 FAIL  src/util/azure/__tests__/resource-group.d.ts
  ● Test suite failed to run

    Your test suite must contain at least one test.

      at node_modules/@jest/core/build/TestScheduler.js:242:24
      at asyncGeneratorStep (node_modules/@jest/core/build/TestScheduler.js:131:24)
      at _next (node_modules/@jest/core/build/TestScheduler.js:151:9)
      at node_modules/@jest/core/build/TestScheduler.js:156:7
      at node_modules/@jest/core/build/TestScheduler.js:148:12
      at onResult (node_modules/@jest/core/build/TestScheduler.js:271:25)

 FAIL  src/util/azure/__tests__/subscription.d.ts
  ● Test suite failed to run

    Your test suite must contain at least one test.

      at node_modules/@jest/core/build/TestScheduler.js:242:24
      at asyncGeneratorStep (node_modules/@jest/core/build/TestScheduler.js:131:24)
      at _next (node_modules/@jest/core/build/TestScheduler.js:151:9)
      at node_modules/@jest/core/build/TestScheduler.js:156:7
      at node_modules/@jest/core/build/TestScheduler.js:148:12
      at onResult (node_modules/@jest/core/build/TestScheduler.js:271:25)

Test Suites: 5 failed, 4 passed, 9 total
Tests:       3 failed, 1 skipped, 14 passed, 18 total
Snapshots:   0 total
Time:        2.406s, estimated 5s
Ran all test suites.

Watch Usage: Press w to show more.
softchris commented 5 years ago

yes there is an issue on that.. .js files and description files needs to be removed before tests can be run https://github.com/Azure/ng-deploy-azure/issues/12 otherwise you get these weird errors