Split test utilities out into its own file.
This commit is contained in:
parent
a6e972d14c
commit
9053bd2f6e
|
@ -43,7 +43,7 @@
|
|||
"ts": "module"
|
||||
},
|
||||
"files": [
|
||||
"tests/**/*.ts"
|
||||
"tests/**/*.test.ts"
|
||||
],
|
||||
"nodeArguments": [
|
||||
"--loader=ts-node/esm",
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
export async function sleep(timeout = 250): Promise<void> {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
}, timeout);
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue