Skip to content

Commit b31785f

Browse files
committed
Add flow tests
1 parent 9237aaa commit b31785f

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

tests/flow.vader

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# vim:set et sw=4 ts=4 tw=79:
2+
Given javascript (typed):
3+
function foo(foo: string = 'foo', bar: number = 1): string {
4+
return 'foo'
5+
}
6+
7+
Execute:
8+
JsDoc
9+
10+
Expect javascript:
11+
/**
12+
* foo
13+
*
14+
* @param {string} foo='foo'
15+
* @param {number} bar=1
16+
* @returns {string}
17+
*/
18+
function foo(foo: string = 'foo', bar: number = 1): string {
19+
return 'foo'
20+
}
21+
22+
Given javascript (union):
23+
function foo(): number | string {
24+
return 'foo'
25+
}
26+
27+
Execute:
28+
JsDoc
29+
30+
Expect javascript:
31+
/**
32+
* foo
33+
*
34+
* @returns {number | string}
35+
*/
36+
function foo(): number | string {
37+
return 'foo'
38+
}
39+
40+
Given javascript (interface):
41+
type Props = {
42+
foo?: string
43+
}
44+
45+
Execute:
46+
JsDoc
47+
48+
Expect javascript:
49+
/**
50+
* Props
51+
*/
52+
type Props = {
53+
foo?: string
54+
}
55+
56+
Given javascript (implements):
57+
class Bar extends Foo implements IFoo {
58+
}
59+
60+
Execute:
61+
JsDoc
62+
63+
Expect javascript:
64+
/**
65+
* Bar
66+
*
67+
* @implements {IFoo}
68+
* @extends {Foo}
69+
*/
70+
class Bar extends Foo implements IFoo {
71+
}
72+
73+
Given javascript (scope arguments):
74+
class Bar extends Foo<Props> {
75+
constructor(arg1: string, arg2: string) {
76+
super()
77+
}
78+
}

0 commit comments

Comments
 (0)