import {createStore, initLocalVue, mountComposition} from '~/tests/unit/Helpers' import { form } from '~/tests/unit/fixture/state/profile' import { $useForm, UseForm } from '~/use/form/useForm' import { AnyStore } from '~/types/interfaces' let store: AnyStore beforeAll(() => { store = createStore() store.registerModule('form', form) initLocalVue({store: store}) }) describe('markFormAsDirty()', () => { it('should call addEventListener one time', async () => { const spy = jest.spyOn(UseForm.prototype as any, 'addEventListener') spy.mockImplementation(() => {}) const component = mountComposition(() => { const {markFormAsDirty} = $useForm(); markFormAsDirty() expect(spy).toHaveBeenCalled() }); }) }) describe('markAsNotDirty()', () => { it('should call clearEventListener one time', async () => { const spy = jest.spyOn(UseForm.prototype as any, 'clearEventListener') spy.mockImplementation(() => {}) const component = mountComposition(() => { const { markFormAsNotDirty } = $useForm() markFormAsNotDirty() expect(spy).toHaveBeenCalled() }); }) })