Browse Source

test(common-ui): assert late api options payload

pull/8371/head
kilisamemarisaaa 4 weeks ago
parent
commit
8ce52ad6ce
  1. 11
      packages/effects/common-ui/src/components/api-component/__tests__/api-component.test.ts

11
packages/effects/common-ui/src/components/api-component/__tests__/api-component.test.ts

@ -146,12 +146,21 @@ describe('api-component.vue', () => {
},
});
mount(Harness);
const wrapper = mount(Harness);
expect(api).not.toHaveBeenCalled();
apiRef.value = api;
await nextTick();
expect(api).toHaveBeenCalledTimes(1);
await vi.waitFor(() => {
const events = wrapper
.findComponent(ApiComponent)
.emitted('optionsChange');
const lastEvent = events?.at(-1)?.[0];
expect(lastEvent).toEqual([
expect.objectContaining({ label: 'Loaded', value: 'loaded' }),
]);
});
});
});

Loading…
Cancel
Save