| 8 | const contract = oc.input(inputSchema).output(outputSchema) |
| 9 | |
| 10 | class _ImplProcedureController { |
| 11 | @Implement(contract) |
| 12 | ping() { |
| 13 | return implement(contract).handler(() => ({}) as any) |
| 14 | } |
| 15 | |
| 16 | @Implement(contract) |
| 17 | ping_with_middleware_context() { |
| 18 | return implement(contract).use(({ next }) => next({ context: { extra: 'value' } })).handler(() => ({}) as any) |
| 19 | } |
| 20 | |
| 21 | // @ts-expect-error --- return invalid |
| 22 | @Implement(contract) |
| 23 | ping_invalid() { |
| 24 | return 'invalid' |
| 25 | } |
| 26 | |
| 27 | // @ts-expect-error --- initial context is not allowed |
| 28 | @Implement(contract) |
| 29 | ping_invalid_initial_context() { |
| 30 | return implement(contract).$context<{ a: string }>().handler(() => ({}) as any) |
| 31 | } |
| 32 | |
| 33 | // @ts-expect-error --- implement wrong contract |
| 34 | @Implement(contract) |
| 35 | ping_wrong_implement() { |
| 36 | return implement(oc.input(inputSchema)).handler(() => ({}) as any) |
| 37 | } |
| 38 | } |
| 39 | }) |
| 40 | |
| 41 | it('require return an implemented router and without initial context', () => { |
nothing calls this directly
no test coverage detected