Split test utilities out into its own file.

This commit is contained in:
Bauke 2022-03-16 15:49:50 +01:00
parent a6e972d14c
commit 9053bd2f6e
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
3 changed files with 9 additions and 9 deletions

View File

@ -43,7 +43,7 @@
"ts": "module"
},
"files": [
"tests/**/*.ts"
"tests/**/*.test.ts"
],
"nodeArguments": [
"--loader=ts-node/esm",

View File

@ -4,6 +4,7 @@ import {html} from 'htm/preact';
import {render} from 'preact';
import {ConfirmButton, ConfirmButtonProps} from '../../source/gram.js';
import {sleep} from '../utilities.js';
test.before(() => {
GlobalRegistrator.register();
@ -39,11 +40,3 @@ test('ConfirmButton', async (t) => {
t.snapshot(buttonElement.outerHTML, 'Confirm state');
buttonElement.click();
});
const sleep = async (timeout = 250): Promise<void> => {
return new Promise((resolve) => {
setTimeout(() => {
resolve();
}, timeout);
});
};

7
tests/utilities.ts Normal file
View File

@ -0,0 +1,7 @@
export async function sleep(timeout = 250): Promise<void> {
return new Promise((resolve) => {
setTimeout(() => {
resolve();
}, timeout);
});
}