From 2d2b156930d4d9cda74763ae12a8cb46b4670062 Mon Sep 17 00:00:00 2001 From: Russell Stephens Date: Tue, 4 Sep 2018 13:33:25 -0400 Subject: [PATCH] add test for variable map --- SnailTests/VariableTests.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/SnailTests/VariableTests.swift b/SnailTests/VariableTests.swift index e2b2f9e..d6c596a 100644 --- a/SnailTests/VariableTests.swift +++ b/SnailTests/VariableTests.swift @@ -78,6 +78,19 @@ class VariableTests: XCTestCase { XCTAssertTrue(firedCount == 1) } + func testVariableFireCounts() { + let subject = Variable("one") + var firedCount = 0 + + subject.map { $0.count }.asObservable().subscribe(onNext: { _ in + firedCount += 1 + }) + + subject.value = "two" + + XCTAssertTrue(firedCount == 2) + } + func testMapToVoid() { let subject = Variable("initial") var fired = false