From 9360223165acaa5197816d682b3cc4493c316c1f Mon Sep 17 00:00:00 2001 From: Stephen Jason Wang Date: Tue, 22 Aug 2023 22:24:05 +0800 Subject: [PATCH] remove: failing test --- .../shared/BasicBalanceInput.test.ts | 75 ------------------- 1 file changed, 75 deletions(-) delete mode 100644 tests/unit-testing/components/shared/BasicBalanceInput.test.ts diff --git a/tests/unit-testing/components/shared/BasicBalanceInput.test.ts b/tests/unit-testing/components/shared/BasicBalanceInput.test.ts deleted file mode 100644 index 89a279174d..0000000000 --- a/tests/unit-testing/components/shared/BasicBalanceInput.test.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { mount } from '@vue/test-utils' -import { expect, it, vi } from 'vitest' - -import BasicBalanceInput from '@/components/shared/form/BasicBalanceInput.vue' - -let wrapper, input - -describe('BalanceInput.vue', () => { - vi.useFakeTimers() - - beforeAll(() => { - Object.defineProperty(window, 'matchMedia', { - writable: true, - value: vi.fn().mockImplementation((query) => ({ - matches: false, - media: query, - onchange: null, - addListener: vi.fn(), - removeListener: vi.fn(), - addEventListener: vi.fn(), - removeEventListener: vi.fn(), - dispatchEvent: vi.fn(), - })), - }) - ;(window as any).usePrefix = () => ({ - urlPrefix: { - value: 'rmrk', - }, - }) - wrapper = mount(BasicBalanceInput, { - propsData: { - min: 10, - max: 100, - unit: 'KSM', - }, - attachTo: document.body, - mocks: { - $t: () => '', - $config: { - prefix: 'rmrk', - }, - }, - }) - input = wrapper.find('[data-testid="balance-input"]') - }) - - it('should focus on input element', async () => { - await wrapper.vm.focusInput() - expect(input.element).toBe(document.activeElement) - }) - - it('should check input with html5validity', async () => { - await input.setValue('0') - expect(await wrapper.vm.checkValidity()).toBe(false) - await input.setValue('50') - expect(await wrapper.vm.checkValidity()).toBe(true) - await input.setValue('900') - expect(await wrapper.vm.checkValidity()).toBe(false) - }) - - it('should set proper value from props', async () => { - await wrapper.setProps({ value: '1000000000000' }) - expect((input.element as HTMLInputElement).value).toBe('1') - }) - - it('should convert value based on unit', async () => { - await input.setValue('1') - vi.runAllTimers() - expect(wrapper.emitted().input).toBeTruthy() - expect(wrapper.emitted().input?.at(-1)).toStrictEqual([ - '1000000000000', - '1', - ]) - }) -})