Skip to content

Commit 665515e

Browse files
committed
chore: tests
1 parent 8107e52 commit 665515e

12 files changed

Lines changed: 176 additions & 4 deletions

File tree

src/converters/component/component.converter.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ describe('Component converter', () => {
1717
implementation: '',
1818
template: '',
1919
styles: '',
20+
methods: [],
2021
methodsPublicExplicit: [],
2122
fieldsPublicExplicit: [],
2223
},
@@ -33,6 +34,7 @@ describe('Component converter', () => {
3334
implementation: '',
3435
template: '',
3536
styles: '',
37+
methods: [],
3638
methodsPublicExplicit: [],
3739
fieldsPublicExplicit: [],
3840
},
@@ -49,6 +51,7 @@ describe('Component converter', () => {
4951
implementation: '',
5052
template: '',
5153
styles: '',
54+
methods: [],
5255
methodsPublicExplicit: [],
5356
fieldsPublicExplicit: [],
5457
},

src/converters/directive/directive.converter.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ describe('Directive converter', () => {
1313
inputs: [],
1414
outputs: [],
1515
implementation: '',
16+
methods: [],
1617
methodsPublicExplicit: [],
1718
fieldsPublicExplicit: [],
1819
},
@@ -25,6 +26,7 @@ describe('Directive converter', () => {
2526
inputs: [],
2627
outputs: [],
2728
implementation: '',
29+
methods: [],
2830
methodsPublicExplicit: [],
2931
fieldsPublicExplicit: [],
3032
},
@@ -37,6 +39,7 @@ describe('Directive converter', () => {
3739
inputs: [],
3840
outputs: [],
3941
implementation: '',
42+
methods: [],
4043
methodsPublicExplicit: [],
4144
fieldsPublicExplicit: [],
4245
},

src/converters/harness/harness.converter.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,21 @@ describe('Harness converter', () => {
88
className: 'first',
99
type: NgParselOutputType.HARNESS,
1010
filePath: '',
11+
methods: [],
1112
methodsPublicExplicit: [],
1213
},
1314
{
1415
className: 'second',
1516
type: NgParselOutputType.HARNESS,
1617
filePath: '',
18+
methods: [],
1719
methodsPublicExplicit: [],
1820
},
1921
{
2022
className: 'third',
2123
type: NgParselOutputType.HARNESS,
2224
filePath: '',
25+
methods: [],
2326
methodsPublicExplicit: [],
2427
},
2528
];

src/converters/service/service.converter.component.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,23 @@ describe('Service stats converter', () => {
1010
type: NgParselOutputType.SERVICE,
1111
filePath: '',
1212
fieldsPublicExplicit: [],
13+
methods: [],
1314
methodsPublicExplicit: [],
1415
},
1516
{
1617
className: 'second',
1718
type: NgParselOutputType.SERVICE,
1819
filePath: '',
1920
fieldsPublicExplicit: [],
21+
methods: [],
2022
methodsPublicExplicit: [],
2123
},
2224
{
2325
className: 'third',
2426
type: NgParselOutputType.SERVICE,
2527
filePath: '',
2628
fieldsPublicExplicit: [],
29+
methods: [],
2730
methodsPublicExplicit: [],
2831
},
2932
];

src/parser/component/component.parser.spec.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,28 @@ describe('ComponentParser', () => {
6464
},
6565
],
6666
implementation,
67+
methods: [
68+
{
69+
name: 'foo',
70+
args: [{ name: 'bar', type: 'string' }],
71+
returnType: 'string',
72+
jsDoc: undefined,
73+
accessType: 'public',
74+
},
75+
{
76+
name: 'bar',
77+
args: [{ name: 'foo', type: 'string' }],
78+
returnType: 'string',
79+
jsDoc: undefined,
80+
accessType: 'publicImplicit',
81+
},
82+
],
6783
methodsPublicExplicit: [
6884
{
6985
name: 'foo',
7086
args: [{ name: 'bar', type: 'string' }],
7187
returnType: 'string',
88+
accessType: 'public',
7289
},
7390
],
7491
fieldsPublicExplicit: [
@@ -78,6 +95,7 @@ describe('ComponentParser', () => {
7895
value: `signal<string>('')`,
7996
},
8097
],
98+
classJsDoc: undefined,
8199
};
82100
jest.spyOn(fs, 'readFileSync').mockReturnValue(implementation);
83101

@@ -139,14 +157,32 @@ describe('ComponentParser', () => {
139157
},
140158
],
141159
implementation,
160+
methods: [
161+
{
162+
name: 'foo',
163+
args: [{ name: 'bar', type: 'string' }],
164+
returnType: 'string',
165+
jsDoc: undefined,
166+
accessType: 'public',
167+
},
168+
{
169+
name: 'bar',
170+
args: [{ name: 'foo', type: 'string' }],
171+
returnType: 'string',
172+
jsDoc: undefined,
173+
accessType: 'publicImplicit',
174+
},
175+
],
142176
methodsPublicExplicit: [
143177
{
144178
name: 'foo',
145179
args: [{ name: 'bar', type: 'string' }],
146180
returnType: 'string',
181+
accessType: 'public',
147182
},
148183
],
149184
fieldsPublicExplicit: [],
185+
classJsDoc: undefined,
150186
};
151187
jest.spyOn(fs, 'readFileSync').mockReturnValue(implementation);
152188

src/parser/directive/directive.parser.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ describe('DirectiveParser', () => {
3838
type: 'string',
3939
initializer: undefined,
4040
field: '@Input() foo: string',
41+
jsDoc: undefined,
4142
},
4243
],
4344
outputs: [
@@ -47,9 +48,11 @@ describe('DirectiveParser', () => {
4748
type: undefined,
4849
initializer: 'new EventEmitter()',
4950
field: '@Output() bar = new EventEmitter()',
51+
jsDoc: undefined,
5052
},
5153
],
5254
implementation,
55+
methods: [],
5356
methodsPublicExplicit: [],
5457
fieldsPublicExplicit: [
5558
{
@@ -58,6 +61,7 @@ describe('DirectiveParser', () => {
5861
value: `signal<string>('')`,
5962
},
6063
],
64+
classJsDoc: undefined,
6165
};
6266
jest.spyOn(fs, 'readFileSync').mockReturnValue(implementation);
6367

@@ -91,6 +95,7 @@ describe('DirectiveParser', () => {
9195
type: 'string',
9296
initializer: undefined,
9397
field: '@Input() foo: string',
98+
jsDoc: undefined,
9499
},
95100
],
96101
outputs: [
@@ -100,11 +105,14 @@ describe('DirectiveParser', () => {
100105
type: undefined,
101106
initializer: 'new EventEmitter()',
102107
field: '@Output() bar = new EventEmitter()',
108+
jsDoc: undefined,
103109
},
104110
],
105111
implementation,
112+
methods: [],
106113
methodsPublicExplicit: [],
107114
fieldsPublicExplicit: [],
115+
classJsDoc: undefined,
108116
};
109117
jest.spyOn(fs, 'readFileSync').mockReturnValue(implementation);
110118

src/parser/harness/harness.parser.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,34 @@ describe('HarnessParser', () => {
2121
type: NgParselOutputType.HARNESS,
2222
filePath,
2323
className: 'MyTestHarness',
24+
methods: [
25+
{
26+
name: 'foo',
27+
args: [{ name: 'test', type: 'string' }],
28+
returnType: 'Promise<string>',
29+
jsDoc: undefined,
30+
accessType: 'public',
31+
},
32+
{
33+
name: 'bar',
34+
args: [],
35+
returnType: 'Promise<boolean>',
36+
jsDoc: undefined,
37+
accessType: 'public',
38+
},
39+
],
2440
methodsPublicExplicit: [
2541
{
2642
name: 'foo',
2743
args: [{ name: 'test', type: 'string' }],
2844
returnType: 'Promise<string>',
45+
accessType: 'public',
2946
},
3047
{
3148
name: 'bar',
3249
args: [],
3350
returnType: 'Promise<boolean>',
51+
accessType: 'public',
3452
},
3553
],
3654
};

src/parser/services/service.parser.spec.ts

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,32 @@ describe('ServiceParser', () => {
2525
className,
2626
filePath,
2727
fieldsPublicExplicit: [],
28+
methods: [
29+
{
30+
name: 'foo',
31+
args: [
32+
{
33+
name: 'bar',
34+
type: 'string',
35+
},
36+
],
37+
returnType: 'string',
38+
jsDoc: undefined,
39+
accessType: 'public',
40+
},
41+
{
42+
name: 'bar',
43+
args: [
44+
{
45+
name: 'foo',
46+
type: 'string',
47+
},
48+
],
49+
returnType: 'string',
50+
jsDoc: undefined,
51+
accessType: 'publicImplicit',
52+
},
53+
],
2854
methodsPublicExplicit: [
2955
{
3056
name: 'foo',
@@ -35,8 +61,10 @@ describe('ServiceParser', () => {
3561
},
3662
],
3763
returnType: 'string',
64+
accessType: 'public',
3865
},
3966
],
67+
classJsDoc: undefined,
4068
};
4169

4270
const parselOutput = parseService(ast, filePath);
@@ -61,7 +89,34 @@ describe('ServiceParser', () => {
6189
className,
6290
filePath,
6391
fieldsPublicExplicit: [],
92+
methods: [
93+
{
94+
name: 'foo',
95+
args: [
96+
{
97+
name: 'bar',
98+
type: 'string',
99+
},
100+
],
101+
returnType: 'string',
102+
jsDoc: undefined,
103+
accessType: 'publicImplicit',
104+
},
105+
{
106+
name: 'bar',
107+
args: [
108+
{
109+
name: 'foo',
110+
type: 'string',
111+
},
112+
],
113+
returnType: 'string',
114+
jsDoc: undefined,
115+
accessType: 'publicImplicit',
116+
},
117+
],
64118
methodsPublicExplicit: [],
119+
classJsDoc: undefined,
65120
};
66121

67122
const parselOutput = parseService(ast, filePath);
@@ -107,7 +162,34 @@ describe('ServiceParser', () => {
107162
type: 'Subject<number>',
108163
},
109164
],
165+
methods: [
166+
{
167+
name: 'foo',
168+
args: [
169+
{
170+
name: 'bar',
171+
type: 'string',
172+
},
173+
],
174+
returnType: 'string',
175+
jsDoc: undefined,
176+
accessType: 'publicImplicit',
177+
},
178+
{
179+
name: 'bar',
180+
args: [
181+
{
182+
name: 'foo',
183+
type: 'string',
184+
},
185+
],
186+
returnType: 'string',
187+
jsDoc: undefined,
188+
accessType: 'publicImplicit',
189+
},
190+
],
110191
methodsPublicExplicit: [],
192+
classJsDoc: undefined,
111193
};
112194

113195
const parselOutput = parseService(ast, filePath);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export type AccessType = 'implicitPublic' | 'public' | 'protected' | 'private';
1+
export type AccessType = 'publicImplicit' | 'public' | 'protected' | 'private';

0 commit comments

Comments
 (0)