| 1234567891011121314151617181920212223242526272829303132 |
- import DataProvider from "~/services/data/dataProvider";
- import {useDataUtils} from "~/composables/data/useDataUtils";
- import {Organization} from "~/models/Organization/Organization";
- import {Ref, ref} from "@nuxtjs/composition-api";
- import {mountComposition} from "~/tests/unit/Helpers";
- import {useForm} from "~/composables/form/useForm";
- jest.mock('~/services/data/dataProvider')
- let useDataUtilsMount:any
- const dataproviderMock = DataProvider as jest.Mocked<typeof DataProvider>
- beforeAll(() => {
- useDataUtilsMount = useDataUtils(dataproviderMock.prototype)
- })
- describe('getItemToEdit()', () => {
- let route:Ref<{}>
- beforeAll(() => {
- const component = mountComposition(() => {
- route = ref({})
- });
- })
- it('should throw an error if id is empty', () => {
- const component = mountComposition(() => {
- expect(() => useDataUtilsMount.getItemToEdit(null, Organization)).toThrowError('id must be exist')
- });
- })
- })
|