Skip to content

Commit

Permalink
Refactor examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Matejkob committed Jun 14, 2023
1 parent ac1b89b commit 06eab69
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Examples/Tests/ViewModelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,27 @@ final class ViewModelTests: XCTestCase {

sut.initializeService(with: serviceName)

XCTAssertTrue(serviceSpy.initializeWithNameSecondNameCalled)
XCTAssertEqual(serviceSpy.initializeWithNameSecondNameReceivedArguments?.name, serviceName)
XCTAssertTrue(serviceSpy.initializeNameCalled)
XCTAssertEqual(serviceSpy.initializeNameReceivedArguments?.name, serviceName)
}

func testSaveConfig() async throws {
let expectedConfig: [String: String] = ["key": "value"]

serviceSpy.fetchConfigWithArgReturnValue = expectedConfig
serviceSpy.fetchConfigArgReturnValue = expectedConfig

try await sut.saveConfig()

XCTAssertEqual(sut.config, expectedConfig)

XCTAssertEqual(serviceSpy.fetchConfigWithArgCallsCount, 1)
XCTAssertEqual(serviceSpy.fetchConfigWithArgReceivedInvocations, [1])
XCTAssertEqual(serviceSpy.fetchConfigArgCallsCount, 1)
XCTAssertEqual(serviceSpy.fetchConfigArgReceivedInvocations, [1])

try await sut.saveConfig()

XCTAssertTrue(sut.config.isEmpty)

XCTAssertEqual(serviceSpy.fetchConfigWithArgCallsCount, 2)
XCTAssertEqual(serviceSpy.fetchConfigWithArgReceivedInvocations, [1, 2])
XCTAssertEqual(serviceSpy.fetchConfigArgCallsCount, 2)
XCTAssertEqual(serviceSpy.fetchConfigArgReceivedInvocations, [1, 2])
}
}

0 comments on commit 06eab69

Please sign in to comment.