Skip to content

Commit

Permalink
update aks unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mantis-toboggan-md committed Jan 10, 2025
1 parent febc454 commit e1b45ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pkg/aks/components/CruAks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ export default defineComponent({
virtualNetwork: {
get() {
return this.virtualNetworkOptions.find((opt) => opt.value === this.config.subnet) || this.t('generic.none');
return this.virtualNetworkOptions.find((opt) => opt.value === this.config.subnet) || { label: this.t('generic.none') };
},
set(neu: {label: string, kind?: string, disabled?: boolean, value?: string, virtualNetwork?: any}) {
if (neu.label === this.t('generic.none')) {
Expand Down
15 changes: 7 additions & 8 deletions pkg/aks/components/__tests__/CruAks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ describe('aks provisioning form', () => {
it('should display subnets grouped by network in the virtual network dropdown', async() => {
const noneOption = { label: 'generic.none' };
const config = {
dnsPrefix: 'abc-123', resourceGroup: 'abc', clusterName: 'abc'
dnsPrefix: 'abc-123', resourceGroup: 'abc', clusterName: 'abc', resourceLocation: 'eastus'
};
const wrapper = shallowMount(CruAks, {
propsData: {
Expand All @@ -254,7 +254,6 @@ describe('aks provisioning form', () => {
const networkOpts = virtualNetworkSelect.props().options;

expect(virtualNetworkSelect.props().value).toStrictEqual(noneOption);

expect(networkOpts).toStrictEqual([{ label: 'generic.none' }, {
disabled: true, kind: 'group', label: 'network2'
}, {
Expand Down Expand Up @@ -299,7 +298,7 @@ describe('aks provisioning form', () => {

it('should prevent saving if a node pool has taints missing keys or values', async() => {
const config = {
dnsPrefix: 'abc-123', resourceGroup: 'abc', clusterName: 'abc'
dnsPrefix: 'abc-123', resourceGroup: 'abc', clusterName: 'abc', resourceLocation: 'eastus'
};
const wrapper = shallowMount(CruAks, {
propsData: {
Expand Down Expand Up @@ -343,7 +342,7 @@ describe('aks provisioning form', () => {
}],
])('should set virtualNetwork, virtualNetworkResourceGroup, and subnet when a virtual network is selected', async(optionIndex, { virtualNetwork, virtualNetworkResourceGroup, subnet }) => {
const config = {
dnsPrefix: 'abc-123', resourceGroup: 'abc', clusterName: 'abc'
dnsPrefix: 'abc-123', resourceGroup: 'abc', clusterName: 'abc', resourceLocation: 'eastus'
};
const wrapper = shallowMount(CruAks, {
propsData: {
Expand All @@ -366,7 +365,7 @@ describe('aks provisioning form', () => {

it('should set config.monitoring to \'true\' and show log anaytics workspace name and log analytics workspace group inputs when the monitoring checkbox is checked', async() => {
const config = {
dnsPrefix: 'abc-123', resourceGroup: 'abc', clusterName: 'abc'
dnsPrefix: 'abc-123', resourceGroup: 'abc', clusterName: 'abc', resourceLocation: 'eastus'
};
const wrapper = shallowMount(CruAks, {
propsData: {
Expand Down Expand Up @@ -397,7 +396,7 @@ describe('aks provisioning form', () => {

it('should clear virtualNetwork, virtualNetworkResourceGroup, and subnet when the \'none\' virtual network option is selected', async() => {
const config = {
dnsPrefix: 'abc-123', resourceGroup: 'abc', clusterName: 'abc'
dnsPrefix: 'abc-123', resourceGroup: 'abc', clusterName: 'abc', resourceLocation: 'eastus'
};
const wrapper = shallowMount(CruAks, {
propsData: {
Expand Down Expand Up @@ -430,7 +429,7 @@ describe('aks provisioning form', () => {
name: 'abc', _validation: {}, _isNewOrUnprovisioned: false, orchestratorVersion: originalVersion
}];
const config = {
dnsPrefix: 'abc-123', resourceGroup: 'abc', clusterName: 'abc', kubernetesVersion: originalVersion, nodePools
dnsPrefix: 'abc-123', resourceGroup: 'abc', clusterName: 'abc', kubernetesVersion: originalVersion, nodePools, resourceLocation: 'eastus'
};
const wrapper = shallowMount(CruAks, {
propsData: {
Expand All @@ -451,7 +450,7 @@ describe('aks provisioning form', () => {

it('should clear config.logAnalyticsWorkspaceName and config.logAnalyticsWorkspaceGroup when the monitoring checkbox is unchecked', async() => {
const config = {
dnsPrefix: 'abc-123', resourceGroup: 'abc', clusterName: 'abc', monitoring: true, logAnalyticsWorkspaceGroup: 'abc', logAnalyticsWorkspaceName: 'def'
dnsPrefix: 'abc-123', resourceGroup: 'abc', clusterName: 'abc', monitoring: true, logAnalyticsWorkspaceGroup: 'abc', logAnalyticsWorkspaceName: 'def', resourceLocation: 'eastus'
};
const wrapper = shallowMount(CruAks, {
propsData: {
Expand Down

0 comments on commit e1b45ef

Please sign in to comment.