Utilização

Assert the result of a user action.

tsx
// 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}$/);
});

Assinaturas

ts
(value: unknown, message?: string): asserts value

Parâmetros

NomeTipoObrigatórioDescrição
valueunknownSim—
messagestringNão—

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.