mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-12-24 22:11:07 +01:00
25 lines
741 B
Swift
25 lines
741 B
Swift
|
@testable import Timeline
|
||
|
import XCTest
|
||
|
import Network
|
||
|
import Models
|
||
|
|
||
|
@MainActor
|
||
|
final class TimelineViewModelTests: XCTestCase {
|
||
|
func testStreamEventInsertNewStatus() async throws {
|
||
|
let subject = TimelineViewModel()
|
||
|
let client = Client(server: "localhost")
|
||
|
subject.client = client
|
||
|
subject.timeline = .home
|
||
|
subject.isTimelineVisible = true
|
||
|
|
||
|
let isEmpty = await subject.datasource.isEmpty
|
||
|
XCTAssertTrue(isEmpty)
|
||
|
await subject.datasource.append(.placeholder())
|
||
|
var count = await subject.datasource.count()
|
||
|
XCTAssertTrue(count == 1)
|
||
|
await subject.handleEvent(event: StreamEventUpdate(status: .placeholder()))
|
||
|
count = await subject.datasource.count()
|
||
|
XCTAssertTrue(count == 2)
|
||
|
}
|
||
|
}
|