1- import { Reactor , App , InPort , OutPort } from "../src/core/internal" ;
1+ import { Reactor , App , InPort , OutPort , CanConnectResult } from "../src/core/internal" ;
22
33class InOut extends Reactor {
44 a = new InPort < string > ( this ) ;
@@ -36,65 +36,57 @@ describe("Container to Contained", () => {
3636 it ( "testing canConnect" , ( ) => {
3737 expect (
3838 app . container . canConnect ( app . container . a , app . container . contained . a )
39- ) . toBe ( true ) ;
39+ ) . toBe ( CanConnectResult . SUCCESS ) ;
4040 expect (
4141 app . container . canConnect ( app . container . contained . a , app . container . a )
42- ) . toBe ( false ) ;
42+ ) . toBe ( CanConnectResult . NOT_IN_SCOPE ) ;
4343 expect (
4444 app . container . canConnect (
4545 app . container . a ,
4646 app . container . b
4747 )
48- ) . toBe ( true ) ;
48+ ) . toBe ( CanConnectResult . SUCCESS ) ;
4949 expect (
5050 app . container . canConnect (
5151 app . container . contained . a ,
5252 app . container . contained . b
5353 )
54- ) . toBe ( false ) ;
54+ ) . toBeTruthy ( ) ;
5555 expect (
5656 app . container . canConnect (
5757 app . container . contained . b ,
5858 app . container . contained . a
5959 )
60- ) . toBe ( true ) ;
60+ ) . toBeFalsy ( ) ;
6161
6262 expect (
6363 app . container . canConnect ( app . container . a , app . container . contained . b )
64- ) . toBe ( false ) ;
64+ ) . toBeTruthy ( ) ;
6565 expect (
6666 app . container . canConnect ( app . container . contained . b , app . container . a )
67- ) . toBe ( false ) ;
67+ ) . toBeTruthy ( ) ;
6868
6969 expect (
7070 app . container . canConnect ( app . container . b , app . container . contained . a )
71- ) . toBe ( false ) ;
71+ ) . toBeTruthy ( ) ;
7272 expect (
7373 app . container . canConnect ( app . container . contained . a , app . container . b )
74- ) . toBe ( false ) ;
74+ ) . toBeTruthy ( ) ;
7575
7676 expect (
7777 app . container . canConnect ( app . container . b , app . container . contained . b )
78- ) . toBe ( false ) ;
78+ ) . toBeTruthy ( ) ;
7979 expect (
8080 app . container . canConnect ( app . container . contained . b , app . container . b )
81- ) . toBe ( true ) ;
82-
83- expect ( app . container . canConnect ( app . container . contained . a , app . foo . a ) ) . toBe (
84- false
85- ) ;
86- expect ( app . container . canConnect ( app . container . contained . a , app . foo . b ) ) . toBe (
87- false
88- ) ;
89- expect ( app . container . canConnect ( app . foo . a , app . container . contained . a ) ) . toBe (
90- false
91- ) ;
92- expect ( app . container . canConnect ( app . foo . a , app . container . contained . a ) ) . toBe (
93- false
94- ) ;
95-
96- expect ( app . container . canConnect ( app . foo . a , app . container . b ) ) . toBe ( false ) ;
97- expect ( app . container . canConnect ( app . foo . a , app . container . a ) ) . toBe ( false ) ;
81+ ) . toBeFalsy ( ) ;
82+
83+ expect ( app . container . canConnect ( app . container . contained . a , app . foo . a ) ) . toBeTruthy ( ) ;
84+ expect ( app . container . canConnect ( app . container . contained . a , app . foo . b ) ) . toBeTruthy ( ) ;
85+ expect ( app . container . canConnect ( app . foo . a , app . container . contained . a ) ) . toBeTruthy ( ) ;
86+ expect ( app . container . canConnect ( app . foo . a , app . container . contained . a ) ) . toBeTruthy ( ) ;
87+
88+ expect ( app . container . canConnect ( app . foo . a , app . container . b ) ) . toBeTruthy ( ) ;
89+ expect ( app . container . canConnect ( app . foo . a , app . container . a ) ) . toBeTruthy ( ) ;
9890
9991 // expect(app.container.contained).toBeDefined();
10092
@@ -104,49 +96,49 @@ describe("Container to Contained", () => {
10496 app . container . contained . containedAgain . a ,
10597 app . container . contained . a
10698 )
107- ) . toBe ( false ) ;
99+ ) . toBeTruthy ( ) ;
108100 expect (
109101 app . container . contained . canConnect (
110102 app . container . contained . containedAgain . b ,
111103 app . container . contained . b
112104 )
113- ) . toBe ( true ) ;
105+ ) . toBeFalsy ( ) ;
114106 expect (
115107 app . container . contained . canConnect (
116108 app . container . contained . containedAgain . a ,
117109 app . container . a
118110 )
119- ) . toBe ( false ) ;
111+ ) . toBeTruthy ( ) ;
120112 expect (
121113 app . container . contained . canConnect (
122114 app . container . contained . containedAgain . b ,
123115 app . container . b
124116 )
125- ) . toBe ( false ) ;
117+ ) . toBeTruthy ( ) ;
126118 expect (
127119 app . container . contained . canConnect (
128120 app . container . contained . containedAgain . a ,
129121 app . foo . a
130122 )
131- ) . toBe ( false ) ;
123+ ) . toBeTruthy ( ) ;
132124 expect (
133125 app . container . contained . canConnect (
134126 app . container . contained . containedAgain . b ,
135127 app . foo . b
136128 )
137- ) . toBe ( false ) ;
129+ ) . toBeTruthy ( ) ;
138130 expect (
139131 app . container . contained . canConnect (
140132 app . container . contained . containedAgain . a ,
141133 app . foo . a
142134 )
143- ) . toBe ( false ) ;
135+ ) . toBeTruthy ( ) ;
144136 expect (
145137 app . container . contained . canConnect (
146138 app . container . contained . containedAgain . b ,
147139 app . foo . b
148140 )
149- ) . toBe ( false ) ;
141+ ) . toBeTruthy ( ) ;
150142 // }
151143 } ) ;
152144} ) ;
0 commit comments