File tree 1 file changed +18
-0
lines changed
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,15 @@ describe('[ curry2 ]', function () {
15
15
expect ( addWith5 ( 3 ) ) . to . eql ( 8 )
16
16
expect ( addWith5 ( 5 ) ) . to . eql ( 10 )
17
17
} )
18
+
19
+ it ( 'curry2 에 함수가 아닌 인자를 입력하는 경우 TypeError 가 발생할 수 있다.' , ( ) => {
20
+ const unknown = curry2 ( 'abc' )
21
+
22
+ expect ( unknown ) . to . be . a ( 'function' )
23
+ expect ( unknown ( 1 ) ) . to . be . a ( 'function' )
24
+ expect ( ( ) => unknown ( 1 ) ( 2 ) ) . to . throw ( TypeError , 'Function.prototype.apply was called on abc, which is a string and not a function' )
25
+ unknown ( 1 ) ( 2 )
26
+ } )
18
27
} )
19
28
20
29
describe ( '[ pipe ]' , function ( ) {
@@ -45,4 +54,13 @@ describe('[ pipe ]', function () {
45
54
await p1 . then ( result => expect ( result ) . to . eql ( 4 ) )
46
55
await p2 . then ( result => expect ( result ) . to . eql ( 6 ) )
47
56
} )
57
+
58
+ it ( 'pipe 중간에 함수가 아닌 인자가 들어가는 경우 TypeError 가 발생할 수 있다.' , ( ) => {
59
+ const f = pipe ( add1 , mul2 , 3 )
60
+
61
+ expect ( f ) . to . be . a ( 'function' )
62
+ expect ( ( ) => f ( 1 ) ) . to . throw ( TypeError , 'f is not a function' )
63
+ expect ( ( ) => f ( 2 ) ) . to . throw ( TypeError , 'f is not a function' )
64
+ f ( 1 )
65
+ } )
48
66
} )
You can’t perform that action at this time.
0 commit comments