File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
ReactiveDataDisplayManagerTests/Utils Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,23 @@ import XCTest
1010
1111final class BaseEventTests : XCTestCase {
1212
13+ func testWhenValueInvokesCorrectly( ) {
14+ // given
15+
16+ let event = BaseEvent < String > ( )
17+ var result = " "
18+
19+ event. addListner { result = $0 }
20+
21+ // when
22+
23+ event. invoke ( with: " invoked " )
24+
25+ // then
26+
27+ XCTAssertEqual ( result, " invoked " )
28+ }
29+
1330 func testWhenNListnersThenNEvents( ) {
1431 // given
1532
@@ -91,4 +108,23 @@ final class BaseEventTests: XCTestCase {
91108 XCTAssertEqual ( event. count, n)
92109 }
93110
111+ func testWhenClearThenNoEvents( ) {
112+ // given
113+
114+ let event = BaseEvent < Int > ( )
115+ var result = false
116+
117+ event. addListner { _ in result = true }
118+
119+ // when
120+
121+ event. clear ( )
122+ event. invoke ( with: 0 )
123+
124+ // then
125+
126+ XCTAssertFalse ( result)
127+ XCTAssertTrue ( event. isEmpty)
128+ }
129+
94130}
You can’t perform that action at this time.
0 commit comments