From d376c3acbfce04d7598640f6a5836437fa1e880a Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 13 Mar 2025 08:02:12 +0100 Subject: [PATCH] refactor: refs #8363 deleted useless test --- .../__tests__/EditFixedPriceForm.spec.js | 56 ------------------- 1 file changed, 56 deletions(-) delete mode 100644 src/components/__tests__/EditFixedPriceForm.spec.js diff --git a/src/components/__tests__/EditFixedPriceForm.spec.js b/src/components/__tests__/EditFixedPriceForm.spec.js deleted file mode 100644 index 670bb6f12..000000000 --- a/src/components/__tests__/EditFixedPriceForm.spec.js +++ /dev/null @@ -1,56 +0,0 @@ -import { createWrapper, axios } from 'app/test/vitest/helper'; -import EditForm from 'src/components/EditFixedPriceForm.vue'; -import { vi, afterEach, beforeAll, describe, expect, it } from 'vitest'; - -const fieldA = 'fieldA'; -const fieldB = 'fieldB'; - -describe('EditForm', () => { - let vm; - const mockRows = [ - { id: 1, itemFk: 101 }, - { id: 2, itemFk: 102 }, - ]; - const mockFieldsOptions = [ - { label: 'Field A', field: fieldA, component: 'input', attrs: {} }, - { label: 'Field B', field: fieldB, component: 'date', attrs: {} }, - ]; - const editUrl = '/api/edit'; - - beforeAll(() => { - vi.spyOn(axios, 'post').mockResolvedValue({ status: 200 }); - vm = createWrapper(EditForm, { - props: { - rows: mockRows, - fieldsOptions: mockFieldsOptions, - editUrl, - }, - }).vm; - }); - - afterEach(() => { - vi.clearAllMocks(); - }); - - describe('onSubmit()', () => { - it('should call axios.post with the correct parameters in the payload', async () => { - const selectedField = { field: fieldA, component: 'input', attrs: {} }; - const newValue = 'Test Value'; - - vm.selectedField = selectedField; - vm.newValue = newValue; - - await vm.onSubmit(); - - const payload = axios.post.mock.calls[0][1]; - - expect(axios.post).toHaveBeenCalledWith(editUrl, expect.any(Object)); - expect(payload.field).toEqual(fieldA); - expect(payload.newValue).toEqual(newValue); - - expect(payload.lines).toEqual(expect.arrayContaining(mockRows)); - - expect(vm.isLoading).toEqual(false); - }); - }); -});