Skip to content

Commit 032424e

Browse files
committed
chore: debug settings
1 parent 7c2b7fc commit 032424e

File tree

2 files changed

+133
-133
lines changed

2 files changed

+133
-133
lines changed

.vscode/launch.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@
239239
"name": "jest structured-types",
240240
"program": "${workspaceFolder}/node_modules/.bin/jest",
241241
"cwd": "${workspaceFolder}/misc/structured-types",
242-
"args": ["jsdoc-params"],
242+
"args": ["function-prop"],
243243
"console": "integratedTerminal",
244244
"internalConsoleOptions": "neverOpen",
245245
"disableOptimisticBPs": true,

misc/structured-types/test/typescript/function/function-prop.test.ts

+132-132
Original file line numberDiff line numberDiff line change
@@ -2,138 +2,6 @@ import path from 'path';
22
import { parseFiles } from '../../../src/index';
33

44
describe('function', () => {
5-
it('function properties', () => {
6-
const results = parseFiles([path.resolve(__dirname, 'function-props.ts')]);
7-
8-
expect(results).toEqual({
9-
fn: {
10-
displayName: 'fn',
11-
kind: 11,
12-
properties: [
13-
{
14-
kind: 1,
15-
description: 'custom property for a function',
16-
displayName: 'customProp',
17-
value: 'my custom prop',
18-
},
19-
],
20-
returns: {
21-
kind: 12,
22-
},
23-
},
24-
});
25-
});
26-
27-
it('object parameter', () => {
28-
const results = parseFiles([
29-
path.resolve(__dirname, 'object-parameter.ts'),
30-
]);
31-
32-
expect(results).toEqual({
33-
printCoord: {
34-
parameters: [
35-
{
36-
displayName: 'pt',
37-
description: 'object parameter',
38-
kind: 15,
39-
properties: [
40-
{
41-
description: 'x coordinate',
42-
kind: 2,
43-
displayName: 'x',
44-
},
45-
{
46-
description: 'optional y coordinate',
47-
kind: 2,
48-
optional: true,
49-
displayName: 'y',
50-
},
51-
],
52-
},
53-
],
54-
description: 'print coordinates',
55-
displayName: 'printCoord',
56-
kind: 11,
57-
returns: {
58-
kind: 12,
59-
},
60-
},
61-
});
62-
});
63-
it('generic function parameter', () => {
64-
const results = parseFiles([
65-
path.resolve(__dirname, 'generic-parameter.ts'),
66-
]);
67-
expect(results).toEqual({
68-
genericFunction: {
69-
displayName: 'genericFunction',
70-
kind: 11,
71-
parameters: [
72-
{
73-
displayName: 'box',
74-
kind: 14,
75-
properties: [
76-
{
77-
parent: 'GenericInterface',
78-
displayName: 'm',
79-
kind: 15,
80-
type: 'T',
81-
},
82-
],
83-
generics: [
84-
{
85-
displayName: 'T',
86-
},
87-
],
88-
},
89-
{
90-
displayName: 'newContents',
91-
kind: 15,
92-
type: 'Type',
93-
},
94-
],
95-
returns: {
96-
kind: 14,
97-
properties: [
98-
{
99-
displayName: 'm',
100-
kind: 15,
101-
type: 'T',
102-
},
103-
],
104-
generics: [
105-
{
106-
displayName: 'T',
107-
},
108-
],
109-
displayName: 'GenericInterface',
110-
},
111-
types: [
112-
{
113-
displayName: 'Type',
114-
},
115-
],
116-
},
117-
__parents: {
118-
GenericInterface: {
119-
displayName: 'GenericInterface',
120-
kind: 14,
121-
properties: [
122-
{
123-
displayName: 'm',
124-
kind: 15,
125-
type: 'T',
126-
},
127-
],
128-
generics: [
129-
{
130-
displayName: 'T',
131-
},
132-
],
133-
},
134-
},
135-
});
136-
});
1375
it('react fc', () => {
1386
const results = parseFiles([path.resolve(__dirname, 'react-fc.ts')]);
1397
expect(results).toEqual({
@@ -908,6 +776,138 @@ describe('function', () => {
908776
},
909777
});
910778
});
779+
it('function properties', () => {
780+
const results = parseFiles([path.resolve(__dirname, 'function-props.ts')]);
781+
782+
expect(results).toEqual({
783+
fn: {
784+
displayName: 'fn',
785+
kind: 11,
786+
properties: [
787+
{
788+
kind: 1,
789+
description: 'custom property for a function',
790+
displayName: 'customProp',
791+
value: 'my custom prop',
792+
},
793+
],
794+
returns: {
795+
kind: 12,
796+
},
797+
},
798+
});
799+
});
800+
801+
it('object parameter', () => {
802+
const results = parseFiles([
803+
path.resolve(__dirname, 'object-parameter.ts'),
804+
]);
805+
806+
expect(results).toEqual({
807+
printCoord: {
808+
parameters: [
809+
{
810+
displayName: 'pt',
811+
description: 'object parameter',
812+
kind: 15,
813+
properties: [
814+
{
815+
description: 'x coordinate',
816+
kind: 2,
817+
displayName: 'x',
818+
},
819+
{
820+
description: 'optional y coordinate',
821+
kind: 2,
822+
optional: true,
823+
displayName: 'y',
824+
},
825+
],
826+
},
827+
],
828+
description: 'print coordinates',
829+
displayName: 'printCoord',
830+
kind: 11,
831+
returns: {
832+
kind: 12,
833+
},
834+
},
835+
});
836+
});
837+
it('generic function parameter', () => {
838+
const results = parseFiles([
839+
path.resolve(__dirname, 'generic-parameter.ts'),
840+
]);
841+
expect(results).toEqual({
842+
genericFunction: {
843+
displayName: 'genericFunction',
844+
kind: 11,
845+
parameters: [
846+
{
847+
displayName: 'box',
848+
kind: 14,
849+
properties: [
850+
{
851+
parent: 'GenericInterface',
852+
displayName: 'm',
853+
kind: 15,
854+
type: 'T',
855+
},
856+
],
857+
generics: [
858+
{
859+
displayName: 'T',
860+
},
861+
],
862+
},
863+
{
864+
displayName: 'newContents',
865+
kind: 15,
866+
type: 'Type',
867+
},
868+
],
869+
returns: {
870+
kind: 14,
871+
properties: [
872+
{
873+
displayName: 'm',
874+
kind: 15,
875+
type: 'T',
876+
},
877+
],
878+
generics: [
879+
{
880+
displayName: 'T',
881+
},
882+
],
883+
displayName: 'GenericInterface',
884+
},
885+
types: [
886+
{
887+
displayName: 'Type',
888+
},
889+
],
890+
},
891+
__parents: {
892+
GenericInterface: {
893+
displayName: 'GenericInterface',
894+
kind: 14,
895+
properties: [
896+
{
897+
displayName: 'm',
898+
kind: 15,
899+
type: 'T',
900+
},
901+
],
902+
generics: [
903+
{
904+
displayName: 'T',
905+
},
906+
],
907+
},
908+
},
909+
});
910+
});
911911

912912
it('extended parameter', () => {
913913
const results = parseFiles([

0 commit comments

Comments
 (0)