Skip to content

Commit cb19868

Browse files
test: add the case where multi paths is present
1 parent ab5bf99 commit cb19868

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

apps/meteor/app/api/server/ApiClass.spec.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,25 @@ describe('ExtractRoutesFromAPI', () => {
5959
true as ExpectedFunctionSignature;
6060
});
6161
});
62+
63+
it('Should extract correct function signature when multi paths is present', () => {
64+
type APIWithMultiPath = APIClass<
65+
'/v1',
66+
{
67+
method: 'POST';
68+
path: ['/v1/endpoint.foo', '/v1/endpoint.bar'];
69+
body: ValidateFunction<{
70+
foo: string;
71+
}>;
72+
response: {
73+
200: ValidateFunction<{
74+
bar: string;
75+
}>;
76+
};
77+
authRequired: true;
78+
}
79+
>;
80+
type APIEndpoints = ExtractRoutesFromAPI<APIWithMultiPath>['/v1/endpoint.test']['POST'];
81+
type ExpectedFunctionSignature = Expect<ShallowEqual<APIEndpoints, (params: { foo: string }) => { bar: string }>>;
82+
true satisfies ExpectedFunctionSignature;
83+
});

0 commit comments

Comments
 (0)