Skip to content

Commit

Permalink
Merge branch 'develop' into fix-cicd-appdeployer-role
Browse files Browse the repository at this point in the history
  • Loading branch information
SanketD92 authored Oct 19, 2021
2 parents a6f6849 + a3f3f09 commit 7462872
Showing 1 changed file with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const scEnvironment = {
rev: 2,
status: 'active',
description: 'sample description',
envTypeConfigId: 'env type config id',
envTypeConfigId: 'existingConfigId',
name: 'name',
projectId: 'project id',
envTypeId: 'env type id',
Expand All @@ -51,10 +51,15 @@ const scEnvironment = {
outputs: [],
};

const scEnvConfig = {
name: 'name',
instanceType: 'instanceType',
};

const envTypesStore = {
getEnvTypeConfigsStore: jest.fn(() => envTypesStore),
load: jest.fn(),
getEnvTypeConfig: jest.fn(),
getEnvTypeConfig: jest.fn(envTypeConfigId => (envTypeConfigId === 'existingConfigId' ? scEnvConfig : undefined)),
};

describe('ScEnvironmentCard', () => {
Expand Down Expand Up @@ -86,10 +91,26 @@ describe('ScEnvironmentCard', () => {
const spyOnConfigsStore = jest.spyOn(component, 'getEnvTypeConfigsStore');

// OPERATE
component.getConfiguration(scEnvironment.envTypeConfigId);
const config = component.getConfiguration(scEnvironment.envTypeConfigId);

// CHECK
expect(spyOnConfigsStore).toHaveBeenCalled();
expect(envTypesStore.getEnvTypeConfig).toHaveBeenCalledWith(scEnvironment.envTypeConfigId);
expect(config.name).toBeDefined();
expect(config.instanceType).toBeDefined();
expect(config).toEqual(scEnvConfig);
});

it('should get undefined configuration', async () => {
// BUILD
const spyOnConfigsStore = jest.spyOn(component, 'getEnvTypeConfigsStore');

// OPERATE
const config = component.getConfiguration('deletedConfigId');

// CHECK
expect(spyOnConfigsStore).toHaveBeenCalled();
expect(envTypesStore.getEnvTypeConfig).toHaveBeenCalledWith('deletedConfigId');
expect(config).toBeUndefined();
});
});

0 comments on commit 7462872

Please sign in to comment.