tests.test
Declares one test, as Node's test runner does, run by kuito test on the headless host.
Utilização
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'));
});Assinaturas
Sobrecarga 1
(name: string, body: Body): voidParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
name | string | Sim | — |
body | Body | Sim | — |
Devolve
void
Sobrecarga 2
(name: string, options: { skip?: boolean | string; only?: boolean; timeout?: number; }, body: Body): voidParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
name | string | Sim | — |
options | { skip?: boolean | string; only?: boolean; timeout?: number;} | Sim | — |
body | Body | Sim | — |
Devolve
void
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.