@@ -22,6 +22,14 @@ describe("do notation", () => {
2222 it ( "bindTo" , ( ) => {
2323 expectRight ( pipe ( Stream . succeed ( 1 ) , Stream . bindTo ( "a" ) ) , { a : 1 } )
2424 expectLeft ( pipe ( Stream . fail ( "left" ) , Stream . bindTo ( "a" ) ) , "left" )
25+ expectRight (
26+ pipe (
27+ Stream . succeed ( 1 ) ,
28+ Stream . bindTo ( "__proto__" ) ,
29+ Stream . let ( "x" , ( ) => 2 )
30+ ) ,
31+ { x : 2 , [ "__proto__" ] : 1 }
32+ )
2533 } )
2634
2735 it ( "bind" , ( ) => {
@@ -37,6 +45,19 @@ describe("do notation", () => {
3745 pipe ( Stream . fail ( "left" ) , Stream . bindTo ( "a" ) , Stream . bind ( "b" , ( ) => Stream . succeed ( 2 ) ) ) ,
3846 "left"
3947 )
48+ expectRight (
49+ pipe (
50+ Stream . succeed ( 1 ) ,
51+ Stream . bindTo ( "a" ) ,
52+ ( x ) =>
53+ pipe (
54+ x ,
55+ Stream . bind ( "__proto__" , ( { a } ) => Stream . succeed ( a + 1 ) )
56+ ) as Stream . Stream < { a : number ; __proto__ : number } , unknown , never > ,
57+ Stream . bind ( "x" , ( ) => Stream . succeed ( 2 ) )
58+ ) ,
59+ { a : 1 , x : 2 , [ "__proto__" ] : 2 }
60+ )
4061 } )
4162
4263 it ( "let" , ( ) => {
@@ -45,5 +66,14 @@ describe("do notation", () => {
4566 pipe ( Stream . fail ( "left" ) , Stream . bindTo ( "a" ) , Stream . let ( "b" , ( ) => 2 ) ) ,
4667 "left"
4768 )
69+ expectRight (
70+ pipe (
71+ Stream . succeed ( 1 ) ,
72+ Stream . bindTo ( "a" ) ,
73+ Stream . let ( "__proto__" , ( { a } ) => a + 1 ) ,
74+ Stream . let ( "x" , ( { a } ) => a + 2 )
75+ ) ,
76+ { a : 1 , x : 3 , [ "__proto__" ] : 2 }
77+ )
4878 } )
4979} )
0 commit comments