1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-18 19:21:39 +03:00
vimr/VimR/VimRTests/RxSwiftCommonsTest.swift
2020-12-25 14:31:34 +01:00

39 lines
819 B
Swift

/**
* Tae Won Ha - http://taewon.de - @hataewon
* See LICENSE
*/
import Nimble
import RxSwift
import RxTest
import XCTest
class RxSwiftCommonsTest: XCTestCase {
func testMapOmittingNil() {
let scheduler = TestScheduler(initialClock: 0)
let xs = scheduler.createHotObservable(
[
Recorded.next(150, 1),
Recorded.next(210, 2),
Recorded.next(220, 3),
Recorded.next(230, 4),
Recorded.next(240, 5),
Recorded.next(260, 6),
Recorded.completed(300),
]
)
let res = scheduler.start { xs.compactMap { $0 % 2 == 0 ? $0 : nil } }
let correctMessages = [
Recorded.next(210, 2),
Recorded.next(230, 4),
Recorded.next(260, 6),
Recorded.completed(300),
]
expect(res.events).to(equal(correctMessages))
}
}