1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-24 22:33:52 +03:00
vimr/VimR/VimRTests/RxSwiftCommonsTest.swift

39 lines
718 B
Swift
Raw Normal View History

2017-05-03 22:43:45 +03:00
/**
* Tae Won Ha - http://taewon.de - @hataewon
* See LICENSE
*/
import Nimble
import RxSwift
import RxTest
2020-09-19 00:14:20 +03:00
import XCTest
2017-05-03 22:43:45 +03:00
class RxSwiftCommonsTest: XCTestCase {
func testMapOmittingNil() {
let scheduler = TestScheduler(initialClock: 0)
let xs = scheduler.createHotObservable(
[
next(150, 1),
next(210, 2),
next(220, 3),
next(230, 4),
next(240, 5),
next(260, 6),
2020-09-19 00:14:20 +03:00
completed(300),
2017-05-03 22:43:45 +03:00
]
)
2019-03-09 19:58:46 +03:00
let res = scheduler.start { xs.compactMap { $0 % 2 == 0 ? $0 : nil } }
2017-05-03 22:43:45 +03:00
let correctMessages = [
next(210, 2),
next(230, 4),
next(260, 6),
2020-09-19 00:14:20 +03:00
completed(300),
2017-05-03 22:43:45 +03:00
]
XCTAssertEqual(res.events, correctMessages)
}
}