This repository was archived by the owner on Oct 17, 2022. It is now read-only.
forked from ferdikoomen/openapi-typescript-codegen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetModelNames.spec.ts
62 lines (60 loc) · 1.7 KB
/
getModelNames.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import type { Model } from '../client/interfaces/Model';
import { getModelNames } from './getModelNames';
describe('getModelNames', () => {
it('should return sorted list', () => {
const john: Model = {
export: 'interface',
name: 'John',
type: 'John',
base: 'John',
template: null,
link: null,
description: null,
isDefinition: true,
isReadOnly: false,
isRequired: false,
isNullable: false,
imports: [],
enum: [],
enums: [],
properties: [],
};
const jane: Model = {
export: 'interface',
name: 'Jane',
type: 'Jane',
base: 'Jane',
template: null,
link: null,
description: null,
isDefinition: true,
isReadOnly: false,
isRequired: false,
isNullable: false,
imports: [],
enum: [],
enums: [],
properties: [],
};
const doe: Model = {
export: 'interface',
name: 'Doe',
type: 'Doe',
base: 'Doe',
template: null,
link: null,
description: null,
isDefinition: true,
isReadOnly: false,
isRequired: false,
isNullable: false,
imports: [],
enum: [],
enums: [],
properties: [],
};
const models: Model[] = [john, jane, doe];
expect(getModelNames([])).toEqual([]);
expect(getModelNames(models)).toEqual(['Doe', 'Jane', 'John']);
});
});