[**Documentation**](../../../README)

***

[Documentation](../../../README) / [zerotal](../../README) / [testing](../README) / assertDatabaseCount

# Function: assertDatabaseCount()

> **assertDatabaseCount**(`table`, `expected`, `where?`): `Promise`\<`void`\>

Defined in: [packages/testing/src/assertions.ts:53](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/testing/src/assertions.ts#L53)

Assert that `table` contains exactly `expected` rows (optionally filtered by `where`).

## Parameters

### table

`string`

### expected

`number`

### where?

`Record`\<`string`, `unknown`\> = `{}`

## Returns

`Promise`\<`void`\>

## Example

```ts
await assertDatabaseCount('users', 3);
await assertDatabaseCount('posts', 1, { published: 1 });
```
