> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tappify.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# tapMatchers

> The four matchers that assert on what a component asked the host to do.

```ts theme={null}
const tapMatchers: {
  toHaveNavigatedTo: MatcherResult;
  toHaveRunAction: MatcherResult;
  toHaveStored: MatcherResult;
  toHaveToasted: MatcherResult;
};
```

The four matchers that assert on what a component asked the host to do.

## Type Declaration

### toHaveNavigatedTo()

```ts theme={null}
toHaveNavigatedTo(received, path): MatcherResult;
```

Passes when `tap.nav.push` was called with exactly that path.

#### Parameters

##### received

`unknown`

##### path

`string`

#### Returns

[`MatcherResult`](/extensions/reference/testing-api/Interface.MatcherResult)

### toHaveRunAction()

```ts theme={null}
toHaveRunAction(
   received, 
   actionId, 
   input?
): MatcherResult;
```

Passes when `tap.actions.run` was called with that action, and with input
deep-equal to `input` when one is given.

#### Parameters

##### received

`unknown`

##### actionId

`string`

##### input?

`unknown`

#### Returns

[`MatcherResult`](/extensions/reference/testing-api/Interface.MatcherResult)

### toHaveStored()

```ts theme={null}
toHaveStored(
   received, 
   collection, 
   document
): MatcherResult;
```

Passes when the mock's storage holds a document deep-equal to that one in
that collection.

#### Parameters

##### received

`unknown`

##### collection

`string`

##### document

`unknown`

#### Returns

[`MatcherResult`](/extensions/reference/testing-api/Interface.MatcherResult)

### toHaveToasted()

```ts theme={null}
toHaveToasted(received, expected): MatcherResult;
```

Passes when a toast matched the string exactly, or the pattern anywhere.

#### Parameters

##### received

`unknown`

##### expected

`string` | `RegExp`

#### Returns

[`MatcherResult`](/extensions/reference/testing-api/Interface.MatcherResult)

## Remarks

Each takes the mock `renderWithTap` returns, so the assertion is
`expect(mock).toHaveToasted(…)` rather than `expect(component)`; anything else
throws a `TapError` carrying `TAP_TEST_TARGET_INVALID`. A failure names every
call that was recorded, so a wrong path or message reads without a debugger. The
vitest and jest presets register these, and both declare the four on the runner's
own `Matchers` interface, so `expect(mock).toHaveToasted` typechecks once the
preset is in the setup files.

## Example

```ts theme={null}
import '@tappify/extension-sdk/testing/vitest';
import { createTapMock } from '@tappify/extension-sdk/testing';
import { expect, it } from 'vitest';

it('toasts when a release ships', () => {
  const mock = createTapMock();
  mock.tap.ui.toast('A release shipped', 'neutral');
  expect(mock).toHaveToasted('A release shipped');
});
```
