-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d0faaa4
commit 8683329
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
sources/Features/Tests/Features/Setup/SetupViewModelTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Igor Kulman on 28.07.2024. | ||
// | ||
|
||
@testable import Setup | ||
import Foundation | ||
import XCTest | ||
|
||
final class SetupViewModelTests: XCTestCase { | ||
func testLoadedData() { | ||
let viewModel = SetupViewModel(settings: .mock(selected: nil), onFinished: {}) | ||
XCTAssertFalse(viewModel.sources.isEmpty) | ||
} | ||
|
||
func testSelectingASource() { | ||
let viewModel = SetupViewModel(settings: .mock(selected: nil), onFinished: {}) | ||
XCTAssertFalse(viewModel.isValid) | ||
|
||
viewModel.select(source: .mock) | ||
XCTAssertTrue(viewModel.isValid) | ||
} | ||
|
||
func testNavigation() { | ||
var finished: Bool = false | ||
let viewModel = SetupViewModel(settings: .mock(selected: nil)) { | ||
finished = true | ||
} | ||
XCTAssertFalse(finished) | ||
|
||
viewModel.select(source: .mock) | ||
viewModel.onNext() | ||
XCTAssertTrue(finished) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters