diff --git a/services/tenant-ui/frontend/test/components/common/ToggleJson.test.ts b/services/tenant-ui/frontend/test/components/common/ToggleJson.test.ts index dc736e646..4188cc66d 100644 --- a/services/tenant-ui/frontend/test/components/common/ToggleJson.test.ts +++ b/services/tenant-ui/frontend/test/components/common/ToggleJson.test.ts @@ -8,52 +8,52 @@ import { tryParseJson } from '@/helpers/jsonParsing'; import ToggleJson from '@/components/common/ToggleJson.vue'; const mountToggleJson = () => - shallowMount(ToggleJson, { - props: { - toJson: () => { - return "{ 'testing': 1 }"; - }, - fromJson: (jsonRepresentation: string) => { - return tryParseJson(jsonRepresentation); - }, - }, - slots: { - default: [CreateSchema, '', 'text'], - }, - global: { - plugins: [PrimeVue, VueToastificationPlugin], - }, - }); + shallowMount(ToggleJson, { + props: { + toJson: () => { + return "{ 'testing': 1 }"; + }, + fromJson: (jsonRepresentation: string) => { + return tryParseJson(jsonRepresentation); + }, + }, + slots: { + default: [CreateSchema, '', 'text'], + }, + global: { + plugins: [PrimeVue, VueToastificationPlugin], + }, + }); describe('Properly Toggle Json Input', () => { - test('reders properly', async () => { - const wrapper = mountToggleJson(); + test('reders properly', async () => { + const wrapper = mountToggleJson(); - expect(wrapper.exists()).toBe(true); - }); - test('text area is only shown after input is toggled', async () => { - const wrapper = mountToggleJson(); - const wrapperVm = wrapper.vm as unknown as typeof ToggleJson; - const toJson = vi.spyOn(wrapperVm.props, 'toJson'); - const fromJson = vi.spyOn(wrapperVm.props, 'fromJson'); + expect(wrapper.exists()).toBe(true); + }); + test('text area is only shown after input is toggled', async () => { + const wrapper = mountToggleJson(); + const wrapperVm = wrapper.vm as unknown as typeof ToggleJson; + const toJson = vi.spyOn(wrapperVm.props, 'toJson'); + const fromJson = vi.spyOn(wrapperVm.props, 'fromJson'); - expect(wrapper.findComponent({ name: 'Textarea' }).isVisible()).toBe(false); - // showRawJson; - expect(wrapper.findComponent({ name: 'InputSwitch' }).exists()).toBe(true); + expect(wrapper.findComponent({ name: 'Textarea' }).isVisible()).toBe(false); + // showRawJson; + expect(wrapper.findComponent({ name: 'InputSwitch' }).exists()).toBe(true); - expect(wrapper.findComponent({ name: 'CreateSchema' }).exists()).toBe(true); - wrapperVm.showRawJson = true; - await wrapperVm.toggleJson(); + expect(wrapper.findComponent({ name: 'CreateSchema' }).exists()).toBe(true); + wrapperVm.showRawJson = true; + await wrapperVm.toggleJson(); - await flushPromises(); + await flushPromises(); - wrapperVm.showRawJson = false; - await wrapperVm.toggleJson(); + wrapperVm.showRawJson = false; + await wrapperVm.toggleJson(); - await flushPromises(); + await flushPromises(); - expect(wrapper.findComponent({ name: 'Textarea' }).isVisible()).toBe(true); - expect(toJson).toHaveBeenCalled(); - expect(fromJson).toHaveBeenCalled(); - }); + expect(wrapper.findComponent({ name: 'Textarea' }).isVisible()).toBe(true); + expect(toJson).toHaveBeenCalled(); + expect(fromJson).toHaveBeenCalled(); + }); });