Skip to content

Commit 6909fa8

Browse files
committed
fix(rpc): tests with controller path resolution based on reflection
1 parent acb2d72 commit 6909fa8

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

packages/rpc/src/decorators.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
} from '@deepkit/type';
2020
import { ControllerDefinition } from './model.js';
2121

22-
class RpcController {
22+
export class RpcController {
2323
// Defaults to the name of the class
2424
name: string = '';
2525

packages/rpc/tests/controller.spec.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { assertType, entity, Positive, ReflectionClass, ReflectionKind } from '@deepkit/type';
22
import { expect, test } from '@jest/globals';
33
import { DirectClient } from '../src/client/client-direct.js';
4-
import { getActions, rpc, rpcClass } from '../src/decorators.js';
4+
import { getActions, rpc, rpcClass, RpcController } from '../src/decorators.js';
55
import { RpcKernel, RpcKernelConnection } from '../src/server/kernel.js';
66
import { Session, SessionState } from '../src/server/security.js';
77
import { BehaviorSubject } from 'rxjs';
@@ -12,9 +12,11 @@ test('default name', () => {
1212
@rpc.controller()
1313
class Controller {}
1414

15-
expect(rpcClass._fetch(Controller)).toMatchObject({
16-
name: 'Controller',
17-
});
15+
const controller = new RpcController();
16+
17+
controller.classType = Controller;
18+
19+
expect(controller.getPath()).toBe('Controller');
1820
});
1921

2022
test('decorator', async () => {

0 commit comments

Comments
 (0)