tests.test
Declares one test, as Node's test runner does, run by kuito test on the headless host.
Verwendung
Define a screen behavior test.
// Define a screen behavior test.
import { Button, Text, VStack, signal } from 'kuito';
import { assert, press, render, screen, test } from 'kuito/tests';
function Counter() {
const count = signal(0);
return (
<VStack>
<Text>{String(count.value)}</Text>
<Button onPress={() => (count.value += 1)}>Add one</Button>
</VStack>
);
}
test('Add one counts the presses', async () => {
await render(<Counter />);
await press(screen.getByText('Add one'));
assert.ok(screen.getByText('1'));
});Signaturen
Überladung 1
(name: string, body: Body): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
name | string | Ja | — |
body | Body | Ja | — |
Rückgabe
void
Überladung 2
(name: string, options: { skip?: boolean | string; only?: boolean; timeout?: number; }, body: Body): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
name | string | Ja | — |
options | { skip?: boolean | string; only?: boolean; timeout?: number;} | Ja | — |
body | Body | Ja | — |
Rückgabe
void
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.