Skip to content

Commit f3615f3

Browse files
committed
Fixed test cases
1 parent 3943c68 commit f3615f3

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

__tests__/ActionInputValidator/ValidatorFactory.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ describe('Test Validator Factory', () => {
2626
jest.spyOn(PublishProfile, 'getPublishProfile').mockImplementation(() => PublishProfile.prototype);
2727
jest.spyOn(PublishProfile.prototype, 'getAppOS').mockImplementation(async() => 'unix');
2828

29-
let validator = await ValidatorFactory.getValidator(type);
30-
expect(validator).toBeInstanceOf(PublishProfileWebAppValidator);
29+
let validators = await ValidatorFactory.getValidator(type);
30+
expect(validators[0]).toBeInstanceOf(PublishProfileWebAppValidator);
3131
});
3232

3333
it("Get Container Validator for Publish Profile auth flow", async() => {
@@ -42,8 +42,8 @@ describe('Test Validator Factory', () => {
4242
jest.spyOn(PublishProfile, 'getPublishProfile').mockImplementation(() => PublishProfile.prototype);
4343
jest.spyOn(PublishProfile.prototype, 'getAppOS').mockImplementation(async() => 'unix');
4444

45-
let validator = await ValidatorFactory.getValidator(type);
46-
expect(validator).toBeInstanceOf(PublishProfileContainerWebAppValidator);
45+
let validators = await ValidatorFactory.getValidator(type);
46+
expect(validators[0]).toBeInstanceOf(PublishProfileContainerWebAppValidator);
4747
});
4848

4949
});
@@ -70,8 +70,8 @@ describe('Test Validator Factory', () => {
7070
};
7171
});
7272

73-
let validator = await ValidatorFactory.getValidator(type);
74-
expect(validator).toBeInstanceOf(SpnLinuxContainerWebAppValidator);
73+
let validators = await ValidatorFactory.getValidator(type);
74+
expect(validators[0]).toBeInstanceOf(SpnLinuxContainerWebAppValidator);
7575
});
7676

7777
it("Get Linux/Kube Code Validator for SPN auth flow", async() => {
@@ -90,8 +90,8 @@ describe('Test Validator Factory', () => {
9090
};
9191
});
9292

93-
let validator = await ValidatorFactory.getValidator(type);
94-
expect(validator).toBeInstanceOf(SpnLinuxWebAppValidator);
93+
let validators = await ValidatorFactory.getValidator(type);
94+
expect(validators[0]).toBeInstanceOf(SpnLinuxWebAppValidator);
9595
});
9696

9797
it("Get Windows Container Validator for SPN auth flow", async() => {
@@ -111,8 +111,8 @@ describe('Test Validator Factory', () => {
111111
};
112112
});
113113

114-
let validator = await ValidatorFactory.getValidator(type);
115-
expect(validator).toBeInstanceOf(SpnWindowsContainerWebAppValidator);
114+
let validators = await ValidatorFactory.getValidator(type);
115+
expect(validators[0]).toBeInstanceOf(SpnWindowsContainerWebAppValidator);
116116
});
117117

118118
it("Get Windows Code Validator for SPN auth flow", async() => {
@@ -131,8 +131,8 @@ describe('Test Validator Factory', () => {
131131
};
132132
});
133133

134-
let validator = await ValidatorFactory.getValidator(type);
135-
expect(validator).toBeInstanceOf(SpnWindowsWebAppValidator);
134+
let validators = await ValidatorFactory.getValidator(type);
135+
expect(validators[0]).toBeInstanceOf(SpnWindowsWebAppValidator);
136136
});
137137

138138
});

__tests__/DeploymentProvider/DeploymentProviderFactory.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ describe('Test Deployment Provider Factory', () => {
1919
it("Get Code Deployment Provider for Publish Profile auth flow", async() => {
2020
let type: DEPLOYMENT_PROVIDER_TYPES = DEPLOYMENT_PROVIDER_TYPES.PUBLISHPROFILE;
2121

22-
let provider = await DeploymentProviderFactory.getDeploymentProvider(type);
23-
expect(provider).toBeInstanceOf(WebAppDeploymentProvider);
22+
let providers = await DeploymentProviderFactory.getDeploymentProvider(type);
23+
expect(providers[0]).toBeInstanceOf(WebAppDeploymentProvider);
2424
});
2525

2626
it("Get Container Deployment Provider for Publish Profile auth flow", async() => {
@@ -32,8 +32,8 @@ describe('Test Deployment Provider Factory', () => {
3232

3333
let type: DEPLOYMENT_PROVIDER_TYPES = DEPLOYMENT_PROVIDER_TYPES.PUBLISHPROFILE;
3434

35-
let provider = await DeploymentProviderFactory.getDeploymentProvider(type);
36-
expect(provider).toBeInstanceOf(PublishProfileWebAppContainerDeploymentProvider);
35+
let providers = await DeploymentProviderFactory.getDeploymentProvider(type);
36+
expect(providers[0]).toBeInstanceOf(PublishProfileWebAppContainerDeploymentProvider);
3737
});
3838

3939
});
@@ -48,8 +48,8 @@ describe('Test Deployment Provider Factory', () => {
4848

4949
let type: DEPLOYMENT_PROVIDER_TYPES = DEPLOYMENT_PROVIDER_TYPES.SPN;
5050

51-
let provider = await DeploymentProviderFactory.getDeploymentProvider(type);
52-
expect(provider).toBeInstanceOf(WebAppDeploymentProvider);
51+
let providers = await DeploymentProviderFactory.getDeploymentProvider(type);
52+
expect(providers[0]).toBeInstanceOf(WebAppDeploymentProvider);
5353
});
5454

5555
it("Get Container Deployment Provider for SPN auth flow", async() => {
@@ -61,8 +61,8 @@ describe('Test Deployment Provider Factory', () => {
6161

6262
let type: DEPLOYMENT_PROVIDER_TYPES = DEPLOYMENT_PROVIDER_TYPES.SPN;
6363

64-
let provider = await DeploymentProviderFactory.getDeploymentProvider(type);
65-
expect(provider).toBeInstanceOf(WebAppContainerDeploymentProvider);
64+
let providers = await DeploymentProviderFactory.getDeploymentProvider(type);
65+
expect(providers[0]).toBeInstanceOf(WebAppContainerDeploymentProvider);
6666
});
6767

6868
});

__tests__/main.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ describe('Test azure-webapps-deploy', () => {
3535
}
3636
return '';
3737
});
38-
let getValidatorFactorySpy = jest.spyOn(ValidatorFactory, 'getValidator').mockImplementation(async _type => new PublishProfileWebAppValidator());
38+
let getValidatorFactorySpy = jest.spyOn(ValidatorFactory, 'getValidator').mockImplementation(async _type => [new PublishProfileWebAppValidator()]);
3939
let ValidatorFactoryValidateSpy = jest.spyOn(PublishProfileWebAppValidator.prototype, 'validate');
40-
let getDeploymentProviderSpy = jest.spyOn(DeploymentProviderFactory, 'getDeploymentProvider').mockImplementation(type => new WebAppDeploymentProvider(type));
40+
let getDeploymentProviderSpy = jest.spyOn(DeploymentProviderFactory, 'getDeploymentProvider').mockImplementation(type => [new WebAppDeploymentProvider(type)]);
4141
let deployWebAppStepSpy = jest.spyOn(WebAppDeploymentProvider.prototype, 'DeployWebAppStep');
4242
let updateDeploymentStatusSpy = jest.spyOn(WebAppDeploymentProvider.prototype, 'UpdateDeploymentStatus');
4343

0 commit comments

Comments
 (0)