1
- import { Reactor , App , InPort , OutPort } from "../src/core/internal" ;
1
+ import { Reactor , App , InPort , OutPort , CanConnectResult } from "../src/core/internal" ;
2
2
3
3
class InOut extends Reactor {
4
4
a = new InPort < string > ( this ) ;
@@ -36,65 +36,57 @@ describe("Container to Contained", () => {
36
36
it ( "testing canConnect" , ( ) => {
37
37
expect (
38
38
app . container . canConnect ( app . container . a , app . container . contained . a )
39
- ) . toBe ( true ) ;
39
+ ) . toBe ( CanConnectResult . SUCCESS ) ;
40
40
expect (
41
41
app . container . canConnect ( app . container . contained . a , app . container . a )
42
- ) . toBe ( false ) ;
42
+ ) . toBe ( CanConnectResult . NOT_IN_SCOPE ) ;
43
43
expect (
44
44
app . container . canConnect (
45
45
app . container . a ,
46
46
app . container . b
47
47
)
48
- ) . toBe ( true ) ;
48
+ ) . toBe ( CanConnectResult . SUCCESS ) ;
49
49
expect (
50
50
app . container . canConnect (
51
51
app . container . contained . a ,
52
52
app . container . contained . b
53
53
)
54
- ) . toBe ( false ) ;
54
+ ) . toBeTruthy ( ) ;
55
55
expect (
56
56
app . container . canConnect (
57
57
app . container . contained . b ,
58
58
app . container . contained . a
59
59
)
60
- ) . toBe ( true ) ;
60
+ ) . toBeFalsy ( ) ;
61
61
62
62
expect (
63
63
app . container . canConnect ( app . container . a , app . container . contained . b )
64
- ) . toBe ( false ) ;
64
+ ) . toBeTruthy ( ) ;
65
65
expect (
66
66
app . container . canConnect ( app . container . contained . b , app . container . a )
67
- ) . toBe ( false ) ;
67
+ ) . toBeTruthy ( ) ;
68
68
69
69
expect (
70
70
app . container . canConnect ( app . container . b , app . container . contained . a )
71
- ) . toBe ( false ) ;
71
+ ) . toBeTruthy ( ) ;
72
72
expect (
73
73
app . container . canConnect ( app . container . contained . a , app . container . b )
74
- ) . toBe ( false ) ;
74
+ ) . toBeTruthy ( ) ;
75
75
76
76
expect (
77
77
app . container . canConnect ( app . container . b , app . container . contained . b )
78
- ) . toBe ( false ) ;
78
+ ) . toBeTruthy ( ) ;
79
79
expect (
80
80
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 ( ) ;
98
90
99
91
// expect(app.container.contained).toBeDefined();
100
92
@@ -104,49 +96,49 @@ describe("Container to Contained", () => {
104
96
app . container . contained . containedAgain . a ,
105
97
app . container . contained . a
106
98
)
107
- ) . toBe ( false ) ;
99
+ ) . toBeTruthy ( ) ;
108
100
expect (
109
101
app . container . contained . canConnect (
110
102
app . container . contained . containedAgain . b ,
111
103
app . container . contained . b
112
104
)
113
- ) . toBe ( true ) ;
105
+ ) . toBeFalsy ( ) ;
114
106
expect (
115
107
app . container . contained . canConnect (
116
108
app . container . contained . containedAgain . a ,
117
109
app . container . a
118
110
)
119
- ) . toBe ( false ) ;
111
+ ) . toBeTruthy ( ) ;
120
112
expect (
121
113
app . container . contained . canConnect (
122
114
app . container . contained . containedAgain . b ,
123
115
app . container . b
124
116
)
125
- ) . toBe ( false ) ;
117
+ ) . toBeTruthy ( ) ;
126
118
expect (
127
119
app . container . contained . canConnect (
128
120
app . container . contained . containedAgain . a ,
129
121
app . foo . a
130
122
)
131
- ) . toBe ( false ) ;
123
+ ) . toBeTruthy ( ) ;
132
124
expect (
133
125
app . container . contained . canConnect (
134
126
app . container . contained . containedAgain . b ,
135
127
app . foo . b
136
128
)
137
- ) . toBe ( false ) ;
129
+ ) . toBeTruthy ( ) ;
138
130
expect (
139
131
app . container . contained . canConnect (
140
132
app . container . contained . containedAgain . a ,
141
133
app . foo . a
142
134
)
143
- ) . toBe ( false ) ;
135
+ ) . toBeTruthy ( ) ;
144
136
expect (
145
137
app . container . contained . canConnect (
146
138
app . container . contained . containedAgain . b ,
147
139
app . foo . b
148
140
)
149
- ) . toBe ( false ) ;
141
+ ) . toBeTruthy ( ) ;
150
142
// }
151
143
} ) ;
152
144
} ) ;
0 commit comments