tests.assert
Node's strict assertions, typed for a Kuito test file, for checking what the app shows and did.
Utilisation
Assert the result of a user action.
// Assert the result of a user action.
import { Text } from 'kuito';
import { assert, render, screen, test } from 'kuito/tests';
const Price = (props: { cents: number }) => <Text>{`$${(props.cents / 100).toFixed(2)}`}</Text>;
test('prices show two decimals', async () => {
await render(<Price cents={1250} />);
const label = screen.getByText(/^\$/);
assert.equal(label.text, '$12.50');
assert.match(label.text ?? '', /\.\d{2}$/);
});Signatures
(value: unknown, message?: string): asserts valueParamètres
| Nom | Type | Requis | Description |
|---|---|---|---|
value | unknown | Oui | — |
message | string | Non | — |
Retourne
void
Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.