[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [Assert](https://evolu.dev/docs/api-reference/common/Assert) › assertConditionAfterMicrotasks

```ts
function assertConditionAfterMicrotasks(
  condition: () => boolean,
  expectedMicrotaskCount: number,
): Promise<void>;
```

Defined in: [packages/common/src/Assert.ts:255](https://github.com/evoluhq/evolu/blob/ecbac001e0c18bbc45b44715f49ecc3a768c5ec9/packages/common/src/Assert.ts#L255)

Asserts that a condition becomes true after exactly the specified number of
microtasks.

Use this in tests that intentionally specify async scheduling behavior.
Application code must not depend on exact microtask counts. Maintainers
should review count changes because they indicate that an async pipeline
changed.

### Example

```ts

let ready = false;
queueMicrotask(() => {
  ready = true;
});

await assertConditionAfterMicrotasks(() => ready, 1);
```