Split test utilities out into its own file.
This commit is contained in:
parent
a6e972d14c
commit
9053bd2f6e
|
@ -43,7 +43,7 @@
|
||||||
"ts": "module"
|
"ts": "module"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"tests/**/*.ts"
|
"tests/**/*.test.ts"
|
||||||
],
|
],
|
||||||
"nodeArguments": [
|
"nodeArguments": [
|
||||||
"--loader=ts-node/esm",
|
"--loader=ts-node/esm",
|
||||||
|
|
|
@ -4,6 +4,7 @@ import {html} from 'htm/preact';
|
||||||
import {render} from 'preact';
|
import {render} from 'preact';
|
||||||
|
|
||||||
import {ConfirmButton, ConfirmButtonProps} from '../../source/gram.js';
|
import {ConfirmButton, ConfirmButtonProps} from '../../source/gram.js';
|
||||||
|
import {sleep} from '../utilities.js';
|
||||||
|
|
||||||
test.before(() => {
|
test.before(() => {
|
||||||
GlobalRegistrator.register();
|
GlobalRegistrator.register();
|
||||||
|
@ -39,11 +40,3 @@ test('ConfirmButton', async (t) => {
|
||||||
t.snapshot(buttonElement.outerHTML, 'Confirm state');
|
t.snapshot(buttonElement.outerHTML, 'Confirm state');
|
||||||
buttonElement.click();
|
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