forked from orval-labs/orval
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoperation.test.ts
More file actions
21 lines (19 loc) 路 778 Bytes
/
Copy pathoperation.test.ts
File metadata and controls
21 lines (19 loc) 路 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { describe, expect, it } from 'vitest';
import { type OpenApiOperationObject, Verbs } from '../types';
import { getOperationId } from './operation';
describe('getOperationId getter', () => {
for (const [input, expected] of [
['/api/test/{id}', 'GetApiTestId'],
['/api/test/{user_id}', 'GetApiTestUserId'],
['/api/test/{locale}.js', 'GetApiTestLocaleJs'],
['/api/test/i18n-{locale}.js', 'GetApiTestI18nLocaleJs'],
['/api/test/{param1}-{param2}.js', 'GetApiTestParam1Param2Js'],
['/api/test/user{param1}-{param2}.html', 'GetApiTestUserparam1Param2Html'],
]) {
it(`should process ${input} to ${expected}`, () => {
expect(
getOperationId({} as OpenApiOperationObject, input, Verbs.GET),
).toBe(expected);
});
}
});