Commit 5e602966 authored by Paul Slaughter's avatar Paul Slaughter

Add missing test to mutations_spec

Also adds expect(...).not.toBe to add assurance
that the state actually changed
parent e9e65bd2
......@@ -9,18 +9,21 @@ import {
describe('GCP Cluster Dropdown Store Mutations', () => {
describe.each`
mutation | stateProperty | mockData
${types.SET_PROJECTS} | ${'projects'} | ${gapiProjectsResponseMock.projects}
${types.SET_ZONES} | ${'zones'} | ${gapiZonesResponseMock.items}
${types.SET_MACHINE_TYPES} | ${'machineTypes'} | ${gapiMachineTypesResponseMock.items}
${types.SET_MACHINE_TYPE} | ${'selectedMachineType'} | ${gapiMachineTypesResponseMock.items[0].name}
${types.SET_ZONE} | ${'selectedZone'} | ${gapiZonesResponseMock.items[0].name}
${types.SET_PROJECT} | ${'selectedProject'} | ${gapiProjectsResponseMock.projects[0]}
${types.SET_PROJECT_BILLING_STATUS} | ${'projectHasBillingEnabled'} | ${true}
mutation | stateProperty | mockData
${types.SET_PROJECTS} | ${'projects'} | ${gapiProjectsResponseMock.projects}
${types.SET_ZONES} | ${'zones'} | ${gapiZonesResponseMock.items}
${types.SET_MACHINE_TYPES} | ${'machineTypes'} | ${gapiMachineTypesResponseMock.items}
${types.SET_MACHINE_TYPE} | ${'selectedMachineType'} | ${gapiMachineTypesResponseMock.items[0].name}
${types.SET_ZONE} | ${'selectedZone'} | ${gapiZonesResponseMock.items[0].name}
${types.SET_PROJECT} | ${'selectedProject'} | ${gapiProjectsResponseMock.projects[0]}
${types.SET_PROJECT_BILLING_STATUS} | ${'projectHasBillingEnabled'} | ${true}
${types.SET_IS_VALIDATING_PROJECT_BILLING} | ${'isValidatingProjectBilling'} | ${true}
`('$mutation', ({ mutation, stateProperty, mockData }) => {
it(`should set the mutation payload to the ${stateProperty} state property`, () => {
const state = createState();
expect(state[stateProperty]).not.toBe(mockData);
mutations[mutation](state, mockData);
expect(state[stateProperty]).toBe(mockData);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment