From 78429320ec4ce52f3cf01627987232ad67dd46a3 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sun, 13 Aug 2023 12:07:37 +0530 Subject: refactor: moves test utils out --- tests/signup.spec.ts | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'tests/signup.spec.ts') diff --git a/tests/signup.spec.ts b/tests/signup.spec.ts index 43cc33a..1317049 100644 --- a/tests/signup.spec.ts +++ b/tests/signup.spec.ts @@ -4,24 +4,12 @@ import { getByText, getByTestId, } from '@testing-library/dom' -import { readFile } from 'node:fs/promises' import '@testing-library/jest-dom' - -import { render } from '../src' - -async function loadFixture(type: string) { - document.documentElement.innerHTML = await readFile( - `./tests/fixtures/${type}/index.html`, - 'utf8', - ) - await render({ root: document.body }) -} - -const delay = (delayMs: number) => new Promise(res => setTimeout(res, delayMs)) +import { delay, loadHTMLFixture } from './util' describe('signup example', () => { beforeEach(async () => { - await loadFixture('signup') + await loadHTMLFixture('signup') window.fetch = jest.fn() as any }) -- cgit v1.3.1