Skip to content
Back to skills

Orpc Testing Mocking

ASecurity

Test oRPC procedures using server-side clients, and mock implementations for frontend testing.

  • 8 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 12, 2026
developmenttestinggitapifrontend

Works with

  • cli
  • api

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add ali-master/skills --skill orpc-testing-mocking --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Orpc Testing Mocking?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Orpc Testing Mocking
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ali-master-orpc-testing-mocking/badge)](https://www.skillsdirectory.com/skills/ali-master-orpc-testing-mocking)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: oRPC Testing & Mocking
description: Test oRPC procedures using server-side clients, and mock implementations for frontend testing.
license: MIT
metadata:
  author: Ali Torki
  homepage: https://github.com/ali-master
  version: "1.0.0"
---

# Testing & Mocking

Strategies for testing and mocking oRPC routers and procedures.

## Testing

Use [Server-Side Clients](/docs/client/server-side) to invoke procedures directly in tests, no additional setup required:

```ts
import { call } from '@orpc/server'

it('works', async () => {
  await expect(
    call(router.planet.list, { page: 1, size: 10 })
  ).resolves.toEqual([
    { id: '1', name: 'Earth' },
    { id: '2', name: 'Mars' },
  ])
})
```

> You can also use the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) to create production-like clients. See [Optimize SSR](/docs/best-practices/optimize-ssr#alternative-approach).

## Mocking

The [Implementer](/docs/contract-first/implement-contract#the-implementer) is designed for contract-first development, but it can also create alternative versions of routers/procedures for testing.

```ts
import { implement, unlazyRouter } from '@orpc/server'

const fakeListPlanet = implement(router.planet.list).handler(() => [])
```

Use `fakeListPlanet` to replace the actual `listPlanet` implementation during tests.

> `implement` is also useful for creating mock servers for frontend testing scenarios.

> `implement` doesn't yet support [lazy routers](/docs/router#lazy-router) — use the `unlazyRouter` utility to convert before implementing.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.