tests.ModuleCall
A call the app made, with its arguments as the platform decoded them.
Utilisation
Assert calls to a native capability.
// Assert calls to a native capability.
import { Button, haptics } from 'kuito';
import { assert, press, render, screen, test, type ModuleCall } from 'kuito/tests';
const Confirm = () => <Button onPress={() => void haptics.notification('success')}>Confirm</Button>;
const named = (calls: readonly ModuleCall[], module: string) =>
calls.filter((call) => call.module === module);
test('confirming plays a success haptic', async () => {
const app = await render(<Confirm />, { modules: { Haptics: { notification: () => {} } } });
await press(screen.getByText('Confirm'));
assert.deepEqual(
named(app.calls, 'Haptics').map((call) => [call.name, call.args]),
[['notification', ['success']]],
);
});Déclaration du type
export interface ModuleCall {
module: string;
name: string;
args: unknown[];
}Membres 3
| Nom | Type | Requis | Description |
|---|---|---|---|
module | string | Oui | — |
name | string | Oui | — |
args | unknown[] | Oui | — |
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.