Commit a2fe5bfb authored by Alexander Turinske's avatar Alexander Turinske

Update policies list test to be more strict

- instead of testing for length of emitted array,
  test the contents itself
parent d734970d
...@@ -208,8 +208,8 @@ describe('PoliciesList component', () => { ...@@ -208,8 +208,8 @@ describe('PoliciesList component', () => {
expect(wrapper.emitted('update-policy-list')).toBeUndefined(); expect(wrapper.emitted('update-policy-list')).toBeUndefined();
wrapper.setProps({ shouldUpdatePolicyList: true }); wrapper.setProps({ shouldUpdatePolicyList: true });
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(scanExecutionPoliciesSpy).toHaveBeenCalledTimes(2);
expect(wrapper.emitted('update-policy-list')).toStrictEqual([[false]]); expect(wrapper.emitted('update-policy-list')).toStrictEqual([[false]]);
expect(scanExecutionPoliciesSpy).toHaveBeenCalledTimes(2);
}); });
it('does not emit `update-policy-list` or refetch scan execution policies on `shouldUpdatePolicyList` change to `false`', async () => { it('does not emit `update-policy-list` or refetch scan execution policies on `shouldUpdatePolicyList` change to `false`', async () => {
...@@ -217,7 +217,7 @@ describe('PoliciesList component', () => { ...@@ -217,7 +217,7 @@ describe('PoliciesList component', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
wrapper.setProps({ shouldUpdatePolicyList: false }); wrapper.setProps({ shouldUpdatePolicyList: false });
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(wrapper.emitted('update-policy-list')).toHaveLength(1); expect(wrapper.emitted('update-policy-list')).toStrictEqual([[false]]);
expect(scanExecutionPoliciesSpy).toHaveBeenCalledTimes(2); expect(scanExecutionPoliciesSpy).toHaveBeenCalledTimes(2);
}); });
}); });
......
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