-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathActivitySampleFollowCellViewModelTests.swift
47 lines (38 loc) · 1.46 KB
/
ActivitySampleFollowCellViewModelTests.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
@testable import KsApi
@testable import Library
import Prelude
import ReactiveExtensions
import ReactiveExtensions_TestHelpers
import ReactiveSwift
import XCTest
internal final class ActivitySampleFollowCellViewModelTests: TestCase {
internal let vm = ActivitySampleFollowCellViewModel()
internal let friendFollowText = TestObserver<String, Never>()
internal let friendImage = TestObserver<String?, Never>()
internal let goToActivity = TestObserver<Void, Never>()
internal override func setUp() {
super.setUp()
self.vm.outputs.friendFollowText.observe(self.friendFollowText.observer)
self.vm.outputs.friendImageURL.map { $0?.absoluteString }.observe(self.friendImage.observer)
self.vm.outputs.goToActivity.observe(self.goToActivity.observer)
}
func testFriendFollowDataEmits() {
let user = User.template
|> \.name .~ "Cool Person"
|> \.avatar.medium .~ "http://coolpic.com/cool.png"
let activity = .template
|> Activity.lens.category .~ .follow
|> Activity.lens.user .~ user
self.vm.inputs.configureWith(activity: activity)
self.friendFollowText.assertValues(
[Strings.activity_user_name_is_now_following_you(user_name: user.name)]
)
self.friendImage.assertValues([user.avatar.medium])
}
func testGoToActivity() {
let activity = Activity.template
self.vm.inputs.configureWith(activity: activity)
self.vm.inputs.seeAllActivityTapped()
self.goToActivity.assertValueCount(1)
}
}