tests.ModuleCall
A call the app made, with its arguments as the platform decoded them.
Verwendung
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']]],
);
});Typdeklaration
export interface ModuleCall {
module: string;
name: string;
args: unknown[];
}Mitglieder 3
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
module | string | Ja | — |
name | string | Ja | — |
args | unknown[] | Ja | — |
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.