- library updated - overrides for the dependencies are now done in the trailing closures - some tests were split to so they cover only 1 case (not 2 cases in one test) - TCA debug trace back again
This commit is contained in:
parent
c8b97a8266
commit
665c792808
|
@ -2522,7 +2522,7 @@
|
||||||
repositoryURL = "https://github.com/pointfreeco/swift-composable-architecture";
|
repositoryURL = "https://github.com/pointfreeco/swift-composable-architecture";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = exactVersion;
|
kind = exactVersion;
|
||||||
version = 0.45.0;
|
version = 0.46.0;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
9E2AC0FD27D8EC120042AA47 /* XCRemoteSwiftPackageReference "MnemonicSwift" */ = {
|
9E2AC0FD27D8EC120042AA47 /* XCRemoteSwiftPackageReference "MnemonicSwift" */ = {
|
||||||
|
|
|
@ -77,8 +77,8 @@
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/pointfreeco/swift-composable-architecture",
|
"location" : "https://github.com/pointfreeco/swift-composable-architecture",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "1fcd53fc875bade47d850749ea53c324f74fd64d",
|
"revision" : "52dca7e5edd6ec9e0b529380843a8cb13f57d7d7",
|
||||||
"version" : "0.45.0"
|
"version" : "0.46.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -454,7 +454,7 @@ extension AppStore {
|
||||||
static var placeholder: AppStore {
|
static var placeholder: AppStore {
|
||||||
AppStore(
|
AppStore(
|
||||||
initialState: .placeholder,
|
initialState: .placeholder,
|
||||||
reducer: AppReducer()
|
reducer: AppReducer()._printChanges()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,16 +86,16 @@ class AppInitializationTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: appState,
|
initialState: appState,
|
||||||
reducer: AppReducer()
|
reducer: AppReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.databaseFiles = .noOp
|
||||||
store.dependencies.databaseFiles = .noOp
|
dependencies.databaseFiles.areDbFilesPresentFor = { _ in true }
|
||||||
store.dependencies.databaseFiles.areDbFilesPresentFor = { _ in true }
|
dependencies.derivationTool = .noOp
|
||||||
store.dependencies.derivationTool = .noOp
|
dependencies.mainQueue = testScheduler.eraseToAnyScheduler()
|
||||||
store.dependencies.mainQueue = testScheduler.eraseToAnyScheduler()
|
dependencies.mnemonic = .mock
|
||||||
store.dependencies.mnemonic = .mock
|
dependencies.randomRecoveryPhrase = recoveryPhraseRandomizer
|
||||||
store.dependencies.randomRecoveryPhrase = recoveryPhraseRandomizer
|
dependencies.walletStorage.exportWallet = { .placeholder }
|
||||||
store.dependencies.walletStorage.exportWallet = { .placeholder }
|
dependencies.walletStorage.areKeysPresent = { true }
|
||||||
store.dependencies.walletStorage.areKeysPresent = { true }
|
}
|
||||||
|
|
||||||
// Root of the test, the app finished the launch process and triggers the checks and initializations.
|
// Root of the test, the app finished the launch process and triggers the checks and initializations.
|
||||||
store.send(.appDelegate(.didFinishLaunching))
|
store.send(.appDelegate(.didFinishLaunching))
|
||||||
|
@ -144,12 +144,12 @@ class AppInitializationTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: .placeholder,
|
initialState: .placeholder,
|
||||||
reducer: AppReducer()
|
reducer: AppReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.databaseFiles = .noOp
|
||||||
store.dependencies.databaseFiles = .noOp
|
dependencies.databaseFiles.areDbFilesPresentFor = { _ in true }
|
||||||
store.dependencies.databaseFiles.areDbFilesPresentFor = { _ in true }
|
dependencies.mainQueue = testScheduler.eraseToAnyScheduler()
|
||||||
store.dependencies.mainQueue = testScheduler.eraseToAnyScheduler()
|
dependencies.walletStorage = .noOp
|
||||||
store.dependencies.walletStorage = .noOp
|
}
|
||||||
|
|
||||||
// Root of the test, the app finished the launch process and triggers the checks and initializations.
|
// Root of the test, the app finished the launch process and triggers the checks and initializations.
|
||||||
store.send(.appDelegate(.didFinishLaunching))
|
store.send(.appDelegate(.didFinishLaunching))
|
||||||
|
@ -177,11 +177,11 @@ class AppInitializationTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: .placeholder,
|
initialState: .placeholder,
|
||||||
reducer: AppReducer()
|
reducer: AppReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.databaseFiles = .noOp
|
||||||
store.dependencies.databaseFiles = .noOp
|
dependencies.mainQueue = testScheduler.eraseToAnyScheduler()
|
||||||
store.dependencies.mainQueue = testScheduler.eraseToAnyScheduler()
|
dependencies.walletStorage = .noOp
|
||||||
store.dependencies.walletStorage = .noOp
|
}
|
||||||
|
|
||||||
// Root of the test, the app finished the launch process and triggers the checks and initializations.
|
// Root of the test, the app finished the launch process and triggers the checks and initializations.
|
||||||
store.send(.appDelegate(.didFinishLaunching))
|
store.send(.appDelegate(.didFinishLaunching))
|
||||||
|
|
|
@ -62,9 +62,9 @@ class AppTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: .placeholder,
|
initialState: .placeholder,
|
||||||
reducer: AppReducer()
|
reducer: AppReducer()
|
||||||
)
|
) {
|
||||||
|
$0.mainQueue = Self.testScheduler.eraseToAnyScheduler()
|
||||||
store.dependencies.mainQueue = Self.testScheduler.eraseToAnyScheduler()
|
}
|
||||||
|
|
||||||
store.send(.respondToWalletInitializationState(.uninitialized))
|
store.send(.respondToWalletInitializationState(.uninitialized))
|
||||||
|
|
||||||
|
@ -91,10 +91,10 @@ class AppTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: .placeholder,
|
initialState: .placeholder,
|
||||||
reducer: AppReducer()
|
reducer: AppReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.walletStorage = .noOp
|
||||||
store.dependencies.walletStorage = .noOp
|
dependencies.walletStorage.exportWallet = { throw "export failed" }
|
||||||
store.dependencies.walletStorage.exportWallet = { throw "export failed" }
|
}
|
||||||
|
|
||||||
store.send(.respondToWalletInitializationState(.filesMissing)) { state in
|
store.send(.respondToWalletInitializationState(.filesMissing)) { state in
|
||||||
state.appInitializationState = .filesMissing
|
state.appInitializationState = .filesMissing
|
||||||
|
@ -112,10 +112,10 @@ class AppTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: .placeholder,
|
initialState: .placeholder,
|
||||||
reducer: AppReducer()
|
reducer: AppReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.walletStorage = .noOp
|
||||||
store.dependencies.walletStorage = .noOp
|
dependencies.walletStorage.exportWallet = { throw "export failed" }
|
||||||
store.dependencies.walletStorage.exportWallet = { throw "export failed" }
|
}
|
||||||
|
|
||||||
store.send(.respondToWalletInitializationState(.initialized))
|
store.send(.respondToWalletInitializationState(.initialized))
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,14 @@ import ComposableArchitecture
|
||||||
|
|
||||||
class RecoveryPhraseDisplayReducerTests: XCTestCase {
|
class RecoveryPhraseDisplayReducerTests: XCTestCase {
|
||||||
func testCopyToBuffer() {
|
func testCopyToBuffer() {
|
||||||
|
let testPasteboard = PasteboardClient.testPasteboard
|
||||||
|
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: RecoveryPhraseDisplayStore.test,
|
initialState: RecoveryPhraseDisplayStore.test,
|
||||||
reducer: RecoveryPhraseDisplayReducer()
|
reducer: RecoveryPhraseDisplayReducer()
|
||||||
)
|
) {
|
||||||
|
$0.pasteboard = testPasteboard
|
||||||
store.dependencies.pasteboard = .testPasteboard
|
}
|
||||||
|
|
||||||
store.send(.copyToBufferPressed) {
|
store.send(.copyToBufferPressed) {
|
||||||
$0.phrase = .placeholder
|
$0.phrase = .placeholder
|
||||||
|
@ -24,7 +26,7 @@ class RecoveryPhraseDisplayReducerTests: XCTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
XCTAssertEqual(
|
XCTAssertEqual(
|
||||||
store.dependencies.pasteboard.getString(),
|
testPasteboard.getString(),
|
||||||
RecoveryPhrase.placeholder.toString()
|
RecoveryPhrase.placeholder.toString()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,14 +82,14 @@ class DeeplinkTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: appState,
|
initialState: appState,
|
||||||
reducer: AppReducer()
|
reducer: AppReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.deeplink = DeeplinkClient(
|
||||||
store.dependencies.deeplink = DeeplinkClient(
|
|
||||||
resolveDeeplinkURL: { _, _ in Deeplink.Route.home }
|
resolveDeeplinkURL: { _, _ in Deeplink.Route.home }
|
||||||
)
|
)
|
||||||
let synchronizer = NoopSDKSynchronizer()
|
let synchronizer = NoopSDKSynchronizer()
|
||||||
synchronizer.updateStateChanged(.synced)
|
synchronizer.updateStateChanged(.synced)
|
||||||
store.dependencies.sdkSynchronizer = synchronizer
|
dependencies.sdkSynchronizer = synchronizer
|
||||||
|
}
|
||||||
|
|
||||||
guard let url = URL(string: "zcash:///home") else {
|
guard let url = URL(string: "zcash:///home") else {
|
||||||
return XCTFail("Deeplink: 'testDeeplinkRequest_homeURL' URL is expected to be valid.")
|
return XCTFail("Deeplink: 'testDeeplinkRequest_homeURL' URL is expected to be valid.")
|
||||||
|
@ -125,17 +125,17 @@ class DeeplinkTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: appState,
|
initialState: appState,
|
||||||
reducer: AppReducer()
|
reducer: AppReducer()
|
||||||
|
) { dependencies in
|
||||||
|
dependencies.deeplink = DeeplinkClient(
|
||||||
|
resolveDeeplinkURL: { _, _ in Deeplink.Route.send(amount: 123_000_000, address: "address", memo: "some text") }
|
||||||
)
|
)
|
||||||
|
dependencies.sdkSynchronizer = synchronizer
|
||||||
|
}
|
||||||
|
|
||||||
guard let url = URL(string: "zcash:///home/send?address=address&memo=some%20text&amount=123000000") else {
|
guard let url = URL(string: "zcash:///home/send?address=address&memo=some%20text&amount=123000000") else {
|
||||||
return XCTFail("Deeplink: 'testDeeplinkRequest_sendURL_amount' URL is expected to be valid.")
|
return XCTFail("Deeplink: 'testDeeplinkRequest_sendURL_amount' URL is expected to be valid.")
|
||||||
}
|
}
|
||||||
|
|
||||||
store.dependencies.deeplink = DeeplinkClient(
|
|
||||||
resolveDeeplinkURL: { _, _ in Deeplink.Route.send(amount: 123_000_000, address: "address", memo: "some text") }
|
|
||||||
)
|
|
||||||
store.dependencies.sdkSynchronizer = synchronizer
|
|
||||||
|
|
||||||
_ = await store.send(.deeplink(url))
|
_ = await store.send(.deeplink(url))
|
||||||
|
|
||||||
let amount = Zatoshi(123_000_000)
|
let amount = Zatoshi(123_000_000)
|
||||||
|
|
|
@ -32,10 +32,10 @@ class HomeTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: .placeholder,
|
initialState: .placeholder,
|
||||||
reducer: HomeReducer()
|
reducer: HomeReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.mainQueue = testScheduler.eraseToAnyScheduler()
|
||||||
store.dependencies.mainQueue = testScheduler.eraseToAnyScheduler()
|
dependencies.sdkSynchronizer = SDKSynchronizerDependency.mock
|
||||||
store.dependencies.sdkSynchronizer = SDKSynchronizerDependency.mock
|
}
|
||||||
|
|
||||||
store.send(.synchronizerStateChanged(.synced))
|
store.send(.synchronizerStateChanged(.synced))
|
||||||
|
|
||||||
|
@ -129,9 +129,9 @@ class HomeTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: .placeholder,
|
initialState: .placeholder,
|
||||||
reducer: HomeReducer()
|
reducer: HomeReducer()
|
||||||
)
|
) {
|
||||||
|
$0.diskSpaceChecker = .mockEmptyDisk
|
||||||
store.dependencies.diskSpaceChecker = .mockEmptyDisk
|
}
|
||||||
|
|
||||||
store.send(.onAppear) { state in
|
store.send(.onAppear) { state in
|
||||||
state.requiredTransactionConfirmations = 10
|
state.requiredTransactionConfirmations = 10
|
||||||
|
@ -151,9 +151,9 @@ class HomeTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: .placeholder,
|
initialState: .placeholder,
|
||||||
reducer: HomeReducer()
|
reducer: HomeReducer()
|
||||||
)
|
) {
|
||||||
|
$0.diskSpaceChecker = .mockFullDisk
|
||||||
store.dependencies.diskSpaceChecker = .mockFullDisk
|
}
|
||||||
|
|
||||||
store.send(.onAppear) { state in
|
store.send(.onAppear) { state in
|
||||||
state.requiredTransactionConfirmations = 10
|
state.requiredTransactionConfirmations = 10
|
||||||
|
|
|
@ -26,10 +26,10 @@ class ImportWalletTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: .placeholder,
|
initialState: .placeholder,
|
||||||
reducer: ImportWalletReducer()
|
reducer: ImportWalletReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.mnemonic = .noOp
|
||||||
store.dependencies.mnemonic = .noOp
|
dependencies.mnemonic.isValid = { _ in throw "invalid mnemonic" }
|
||||||
store.dependencies.mnemonic.isValid = { _ in throw "invalid mnemonic" }
|
}
|
||||||
|
|
||||||
store.send(.binding(.set(\.$importedSeedPhrase, "one two three"))) { state in
|
store.send(.binding(.set(\.$importedSeedPhrase, "one two three"))) { state in
|
||||||
state.importedSeedPhrase = "one two three"
|
state.importedSeedPhrase = "one two three"
|
||||||
|
@ -42,10 +42,10 @@ class ImportWalletTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: ImportWalletReducer.State(maxWordsCount: 24),
|
initialState: ImportWalletReducer.State(maxWordsCount: 24),
|
||||||
reducer: ImportWalletReducer()
|
reducer: ImportWalletReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.mnemonic = .noOp
|
||||||
store.dependencies.mnemonic = .noOp
|
dependencies.mnemonic.isValid = { _ in throw "invalid mnemonic" }
|
||||||
store.dependencies.mnemonic.isValid = { _ in throw "invalid mnemonic" }
|
}
|
||||||
|
|
||||||
store.send(.binding(.set(\.$importedSeedPhrase, "a a a a a a a a a a a a a a a a a a a a a a a a"))) { state in
|
store.send(.binding(.set(\.$importedSeedPhrase, "a a a a a a a a a a a a a a a a a a a a a a a a"))) { state in
|
||||||
state.importedSeedPhrase = "a a a a a a a a a a a a a a a a a a a a a a a a"
|
state.importedSeedPhrase = "a a a a a a a a a a a a a a a a a a a a a a a a"
|
||||||
|
@ -59,9 +59,9 @@ class ImportWalletTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: ImportWalletReducer.State(maxWordsCount: 24),
|
initialState: ImportWalletReducer.State(maxWordsCount: 24),
|
||||||
reducer: ImportWalletReducer()
|
reducer: ImportWalletReducer()
|
||||||
)
|
) {
|
||||||
|
$0.mnemonic = .noOp
|
||||||
store.dependencies.mnemonic = .noOp
|
}
|
||||||
|
|
||||||
store.send(
|
store.send(
|
||||||
.binding(
|
.binding(
|
||||||
|
@ -147,10 +147,10 @@ class ImportWalletTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: ImportWalletReducer.State(maxWordsCount: 24),
|
initialState: ImportWalletReducer.State(maxWordsCount: 24),
|
||||||
reducer: ImportWalletReducer()
|
reducer: ImportWalletReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.mnemonic = .noOp
|
||||||
store.dependencies.mnemonic = .noOp
|
dependencies.mnemonic.isValid = { _ in throw "invalid mnemonic" }
|
||||||
store.dependencies.mnemonic.isValid = { _ in throw "invalid mnemonic" }
|
}
|
||||||
|
|
||||||
store.send(.binding(.set(\.$birthdayHeight, "1700000"))) { state in
|
store.send(.binding(.set(\.$birthdayHeight, "1700000"))) { state in
|
||||||
state.birthdayHeight = "1700000"
|
state.birthdayHeight = "1700000"
|
||||||
|
@ -173,10 +173,10 @@ class ImportWalletTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: ImportWalletReducer.State(maxWordsCount: 24),
|
initialState: ImportWalletReducer.State(maxWordsCount: 24),
|
||||||
reducer: ImportWalletReducer()
|
reducer: ImportWalletReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.mnemonic = .noOp
|
||||||
store.dependencies.mnemonic = .noOp
|
dependencies.mnemonic.isValid = { _ in throw "invalid mnemonic" }
|
||||||
store.dependencies.mnemonic.isValid = { _ in throw "invalid mnemonic" }
|
}
|
||||||
|
|
||||||
store.send(.binding(.set(\.$birthdayHeight, "1600000"))) { state in
|
store.send(.binding(.set(\.$birthdayHeight, "1600000"))) { state in
|
||||||
state.birthdayHeight = "1600000"
|
state.birthdayHeight = "1600000"
|
||||||
|
@ -198,9 +198,9 @@ class ImportWalletTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: ImportWalletReducer.State(maxWordsCount: 24),
|
initialState: ImportWalletReducer.State(maxWordsCount: 24),
|
||||||
reducer: ImportWalletReducer()
|
reducer: ImportWalletReducer()
|
||||||
)
|
) {
|
||||||
|
$0.mnemonic = .noOp
|
||||||
store.dependencies.mnemonic = .noOp
|
}
|
||||||
|
|
||||||
store.send(.binding(.set(\.$birthdayHeight, "1600000"))) { state in
|
store.send(.binding(.set(\.$birthdayHeight, "1600000"))) { state in
|
||||||
state.birthdayHeight = "1600000"
|
state.birthdayHeight = "1600000"
|
||||||
|
@ -239,9 +239,9 @@ class ImportWalletTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: ImportWalletReducer.State(maxWordsCount: 24),
|
initialState: ImportWalletReducer.State(maxWordsCount: 24),
|
||||||
reducer: ImportWalletReducer()
|
reducer: ImportWalletReducer()
|
||||||
)
|
) {
|
||||||
|
$0.mnemonic = .noOp
|
||||||
store.dependencies.mnemonic = .noOp
|
}
|
||||||
|
|
||||||
store.send(.binding(.set(\.$birthdayHeight, "1700000"))) { state in
|
store.send(.binding(.set(\.$birthdayHeight, "1700000"))) { state in
|
||||||
state.birthdayHeight = "1700000"
|
state.birthdayHeight = "1700000"
|
||||||
|
@ -281,9 +281,9 @@ class ImportWalletTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: ImportWalletReducer.State(maxWordsCount: 24),
|
initialState: ImportWalletReducer.State(maxWordsCount: 24),
|
||||||
reducer: ImportWalletReducer()
|
reducer: ImportWalletReducer()
|
||||||
)
|
) {
|
||||||
|
$0.mnemonic = .noOp
|
||||||
store.dependencies.mnemonic = .noOp
|
}
|
||||||
|
|
||||||
store.send(
|
store.send(
|
||||||
.binding(
|
.binding(
|
||||||
|
@ -332,10 +332,10 @@ class ImportWalletTests: XCTestCase {
|
||||||
birthdayHeightValue: 1_700_000
|
birthdayHeightValue: 1_700_000
|
||||||
),
|
),
|
||||||
reducer: ImportWalletReducer()
|
reducer: ImportWalletReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.mnemonic = .noOp
|
||||||
store.dependencies.mnemonic = .noOp
|
dependencies.walletStorage = .noOp
|
||||||
store.dependencies.walletStorage = .noOp
|
}
|
||||||
|
|
||||||
store.send(.restoreWallet) { state in
|
store.send(.restoreWallet) { state in
|
||||||
state.alert = AlertState(
|
state.alert = AlertState(
|
||||||
|
|
|
@ -14,10 +14,10 @@ class ProfileTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: .placeholder,
|
initialState: .placeholder,
|
||||||
reducer: ProfileReducer()
|
reducer: ProfileReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.appVersion = .mock
|
||||||
store.dependencies.appVersion = .mock
|
dependencies.sdkSynchronizer = SDKSynchronizerDependency.mock
|
||||||
store.dependencies.sdkSynchronizer = SDKSynchronizerDependency.mock
|
}
|
||||||
|
|
||||||
store.send(.onAppear) { state in
|
store.send(.onAppear) { state in
|
||||||
state.address = "ff3927e1f83df9b1b0dc75540ddc59ee435eecebae914d2e6dfe8576fbedc9a8"
|
state.address = "ff3927e1f83df9b1b0dc75540ddc59ee435eecebae914d2e6dfe8576fbedc9a8"
|
||||||
|
|
|
@ -291,7 +291,9 @@ class RecoveryPhraseValidationTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: currentStep,
|
initialState: currentStep,
|
||||||
reducer: RecoveryPhraseValidationFlowReducer()
|
reducer: RecoveryPhraseValidationFlowReducer()
|
||||||
)
|
) {
|
||||||
|
$0.mainQueue = Self.testScheduler.eraseToAnyScheduler()
|
||||||
|
}
|
||||||
|
|
||||||
let expectedMissingWordChips = [
|
let expectedMissingWordChips = [
|
||||||
PhraseChip.Kind.empty,
|
PhraseChip.Kind.empty,
|
||||||
|
@ -307,8 +309,6 @@ class RecoveryPhraseValidationTests: XCTestCase {
|
||||||
ValidationWord(groupIndex: 3, word: "pizza")
|
ValidationWord(groupIndex: 3, word: "pizza")
|
||||||
]
|
]
|
||||||
|
|
||||||
store.dependencies.mainQueue = Self.testScheduler.eraseToAnyScheduler()
|
|
||||||
|
|
||||||
store.send(.move(wordChip: PhraseChip.Kind.unassigned(word: "pizza"), intoGroup: 3)) {
|
store.send(.move(wordChip: PhraseChip.Kind.unassigned(word: "pizza"), intoGroup: 3)) {
|
||||||
$0.missingWordChips = expectedMissingWordChips
|
$0.missingWordChips = expectedMissingWordChips
|
||||||
$0.validationWords = expectedValidationWords
|
$0.validationWords = expectedValidationWords
|
||||||
|
@ -363,7 +363,10 @@ class RecoveryPhraseValidationTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: currentStep,
|
initialState: currentStep,
|
||||||
reducer: RecoveryPhraseValidationFlowReducer()
|
reducer: RecoveryPhraseValidationFlowReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.feedbackGenerator = .noOp
|
||||||
|
dependencies.mainQueue = Self.testScheduler.eraseToAnyScheduler()
|
||||||
|
}
|
||||||
|
|
||||||
let expectedMissingWordChips = [
|
let expectedMissingWordChips = [
|
||||||
PhraseChip.Kind.empty,
|
PhraseChip.Kind.empty,
|
||||||
|
@ -379,9 +382,6 @@ class RecoveryPhraseValidationTests: XCTestCase {
|
||||||
ValidationWord(groupIndex: 3, word: "pizza")
|
ValidationWord(groupIndex: 3, word: "pizza")
|
||||||
]
|
]
|
||||||
|
|
||||||
store.dependencies.feedbackGenerator = .noOp
|
|
||||||
store.dependencies.mainQueue = Self.testScheduler.eraseToAnyScheduler()
|
|
||||||
|
|
||||||
store.send(.move(wordChip: PhraseChip.Kind.unassigned(word: "pizza"), intoGroup: 3)) {
|
store.send(.move(wordChip: PhraseChip.Kind.unassigned(word: "pizza"), intoGroup: 3)) {
|
||||||
$0.missingWordChips = expectedMissingWordChips
|
$0.missingWordChips = expectedMissingWordChips
|
||||||
$0.validationWords = expectedValidationWords
|
$0.validationWords = expectedValidationWords
|
||||||
|
|
|
@ -21,9 +21,9 @@ class ScanTests: XCTestCase {
|
||||||
scanStatus: .value("t1gXqfSSQt6WfpwyuCU3Wi7sSVZ66DYQ3Po")
|
scanStatus: .value("t1gXqfSSQt6WfpwyuCU3Wi7sSVZ66DYQ3Po")
|
||||||
),
|
),
|
||||||
reducer: ScanReducer()
|
reducer: ScanReducer()
|
||||||
)
|
) {
|
||||||
|
$0.captureDevice = .noOp
|
||||||
store.dependencies.captureDevice = .noOp
|
}
|
||||||
|
|
||||||
store.send(.onAppear) { state in
|
store.send(.onAppear) { state in
|
||||||
state.isTorchAvailable = false
|
state.isTorchAvailable = false
|
||||||
|
@ -37,9 +37,9 @@ class ScanTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: ScanReducer.State(),
|
initialState: ScanReducer.State(),
|
||||||
reducer: ScanReducer()
|
reducer: ScanReducer()
|
||||||
)
|
) {
|
||||||
|
$0.captureDevice = .noOp
|
||||||
store.dependencies.captureDevice = .noOp
|
}
|
||||||
|
|
||||||
store.send(.torchPressed) { state in
|
store.send(.torchPressed) { state in
|
||||||
state.isTorchOn = true
|
state.isTorchOn = true
|
||||||
|
@ -52,9 +52,9 @@ class ScanTests: XCTestCase {
|
||||||
isTorchOn: true
|
isTorchOn: true
|
||||||
),
|
),
|
||||||
reducer: ScanReducer()
|
reducer: ScanReducer()
|
||||||
)
|
) {
|
||||||
|
$0.captureDevice = .noOp
|
||||||
store.dependencies.captureDevice = .noOp
|
}
|
||||||
|
|
||||||
store.send(.torchPressed) { state in
|
store.send(.torchPressed) { state in
|
||||||
state.isTorchOn = false
|
state.isTorchOn = false
|
||||||
|
@ -65,9 +65,9 @@ class ScanTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: ScanReducer.State(),
|
initialState: ScanReducer.State(),
|
||||||
reducer: ScanReducer()
|
reducer: ScanReducer()
|
||||||
)
|
) {
|
||||||
|
$0.uriParser.isValidURI = { _ in false }
|
||||||
store.dependencies.uriParser.isValidURI = { _ in false }
|
}
|
||||||
|
|
||||||
store.send(.scan("test")) { state in
|
store.send(.scan("test")) { state in
|
||||||
state.scanStatus = .value("test")
|
state.scanStatus = .value("test")
|
||||||
|
@ -81,10 +81,10 @@ class ScanTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: ScanReducer.State(),
|
initialState: ScanReducer.State(),
|
||||||
reducer: ScanReducer()
|
reducer: ScanReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.mainQueue = testScheduler.eraseToAnyScheduler()
|
||||||
store.dependencies.mainQueue = testScheduler.eraseToAnyScheduler()
|
dependencies.uriParser.isValidURI = { _ in true }
|
||||||
store.dependencies.uriParser.isValidURI = { _ in true }
|
}
|
||||||
|
|
||||||
store.send(.scan("t1gXqfSSQt6WfpwyuCU3Wi7sSVZ66DYQ3Po")) { state in
|
store.send(.scan("t1gXqfSSQt6WfpwyuCU3Wi7sSVZ66DYQ3Po")) { state in
|
||||||
state.scanStatus = .value("t1gXqfSSQt6WfpwyuCU3Wi7sSVZ66DYQ3Po")
|
state.scanStatus = .value("t1gXqfSSQt6WfpwyuCU3Wi7sSVZ66DYQ3Po")
|
||||||
|
|
|
@ -34,14 +34,14 @@ class SendTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: .placeholder,
|
initialState: .placeholder,
|
||||||
reducer: SendFlowReducer()
|
reducer: SendFlowReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.derivationTool = .noOp
|
||||||
store.dependencies.derivationTool = .noOp
|
dependencies.derivationTool.deriveSpendingKeys = { _, _ in [""] }
|
||||||
store.dependencies.derivationTool.deriveSpendingKeys = { _, _ in [""] }
|
dependencies.mainQueue = testScheduler.eraseToAnyScheduler()
|
||||||
store.dependencies.mainQueue = testScheduler.eraseToAnyScheduler()
|
dependencies.mnemonic = .mock
|
||||||
store.dependencies.mnemonic = .mock
|
dependencies.sdkSynchronizer = SDKSynchronizerDependency.mock
|
||||||
store.dependencies.sdkSynchronizer = SDKSynchronizerDependency.mock
|
dependencies.walletStorage.exportWallet = { .placeholder }
|
||||||
store.dependencies.walletStorage.exportWallet = { .placeholder }
|
}
|
||||||
|
|
||||||
// simulate the sending confirmation button to be pressed
|
// simulate the sending confirmation button to be pressed
|
||||||
store.send(.sendConfirmationPressed) { state in
|
store.send(.sendConfirmationPressed) { state in
|
||||||
|
@ -93,14 +93,14 @@ class SendTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: state,
|
initialState: state,
|
||||||
reducer: SendFlowReducer()
|
reducer: SendFlowReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.derivationTool = .noOp
|
||||||
store.dependencies.derivationTool = .noOp
|
dependencies.derivationTool.deriveSpendingKeys = { _, _ in [""] }
|
||||||
store.dependencies.derivationTool.deriveSpendingKeys = { _, _ in [""] }
|
dependencies.mainQueue = testScheduler.eraseToAnyScheduler()
|
||||||
store.dependencies.mainQueue = testScheduler.eraseToAnyScheduler()
|
dependencies.mnemonic = .mock
|
||||||
store.dependencies.mnemonic = .mock
|
dependencies.sdkSynchronizer = SDKSynchronizerDependency.mock
|
||||||
store.dependencies.sdkSynchronizer = SDKSynchronizerDependency.mock
|
dependencies.walletStorage.exportWallet = { .placeholder }
|
||||||
store.dependencies.walletStorage.exportWallet = { .placeholder }
|
}
|
||||||
|
|
||||||
// simulate the sending confirmation button to be pressed
|
// simulate the sending confirmation button to be pressed
|
||||||
store.send(.sendConfirmationPressed) { state in
|
store.send(.sendConfirmationPressed) { state in
|
||||||
|
@ -149,13 +149,13 @@ class SendTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: .placeholder,
|
initialState: .placeholder,
|
||||||
reducer: SendFlowReducer()
|
reducer: SendFlowReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.derivationTool = .noOp
|
||||||
store.dependencies.derivationTool = .noOp
|
dependencies.derivationTool.deriveSpendingKeys = { _, _ in [""] }
|
||||||
store.dependencies.derivationTool.deriveSpendingKeys = { _, _ in [""] }
|
dependencies.mainQueue = testScheduler.eraseToAnyScheduler()
|
||||||
store.dependencies.mainQueue = testScheduler.eraseToAnyScheduler()
|
dependencies.mnemonic = .mock
|
||||||
store.dependencies.mnemonic = .mock
|
dependencies.walletStorage.exportWallet = { .placeholder }
|
||||||
store.dependencies.walletStorage.exportWallet = { .placeholder }
|
}
|
||||||
|
|
||||||
// simulate the sending confirmation button to be pressed
|
// simulate the sending confirmation button to be pressed
|
||||||
store.send(.sendConfirmationPressed) { state in
|
store.send(.sendConfirmationPressed) { state in
|
||||||
|
@ -184,14 +184,14 @@ class SendTests: XCTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAddressValidation() throws {
|
func testAddressValidation_Invalid() throws {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: .placeholder,
|
initialState: .placeholder,
|
||||||
reducer: SendFlowReducer()
|
reducer: SendFlowReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.derivationTool = .noOp
|
||||||
store.dependencies.derivationTool = .noOp
|
dependencies.derivationTool.isValidZcashAddress = { _ in false }
|
||||||
store.dependencies.derivationTool.isValidZcashAddress = { _ in false }
|
}
|
||||||
|
|
||||||
store.send(.transactionAddressInput(.textField(.set("3HRG769ii3HDSJV5vNknQPzXqtL2mTSGnr")))) { state in
|
store.send(.transactionAddressInput(.textField(.set("3HRG769ii3HDSJV5vNknQPzXqtL2mTSGnr")))) { state in
|
||||||
state.transactionAddressInputState.textFieldState.text = "3HRG769ii3HDSJV5vNknQPzXqtL2mTSGnr"
|
state.transactionAddressInputState.textFieldState.text = "3HRG769ii3HDSJV5vNknQPzXqtL2mTSGnr"
|
||||||
|
@ -204,8 +204,16 @@ class SendTests: XCTestCase {
|
||||||
"Send Tests: `testAddressValidation` is expected to be true but it's \(state.isInvalidAddressFormat)"
|
"Send Tests: `testAddressValidation` is expected to be true but it's \(state.isInvalidAddressFormat)"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
store.dependencies.derivationTool.isValidZcashAddress = { _ in true }
|
func testAddressValidation_Valid() throws {
|
||||||
|
let store = TestStore(
|
||||||
|
initialState: .placeholder,
|
||||||
|
reducer: SendFlowReducer()
|
||||||
|
) { dependencies in
|
||||||
|
dependencies.derivationTool = .noOp
|
||||||
|
dependencies.derivationTool.isValidZcashAddress = { _ in true }
|
||||||
|
}
|
||||||
|
|
||||||
store.send(.transactionAddressInput(.textField(.set("t1gXqfSSQt6WfpwyuCU3Wi7sSVZ66DYQ3Po")))) { state in
|
store.send(.transactionAddressInput(.textField(.set("t1gXqfSSQt6WfpwyuCU3Wi7sSVZ66DYQ3Po")))) { state in
|
||||||
state.transactionAddressInputState.textFieldState.text = "t1gXqfSSQt6WfpwyuCU3Wi7sSVZ66DYQ3Po"
|
state.transactionAddressInputState.textFieldState.text = "t1gXqfSSQt6WfpwyuCU3Wi7sSVZ66DYQ3Po"
|
||||||
|
@ -224,9 +232,9 @@ class SendTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: .placeholder,
|
initialState: .placeholder,
|
||||||
reducer: SendFlowReducer()
|
reducer: SendFlowReducer()
|
||||||
)
|
) {
|
||||||
|
$0.numberFormatter = .noOp
|
||||||
store.dependencies.numberFormatter = .noOp
|
}
|
||||||
|
|
||||||
// Checks the computed property `isInvalidAmountFormat` which controls the error message to be shown on the screen
|
// Checks the computed property `isInvalidAmountFormat` which controls the error message to be shown on the screen
|
||||||
// With empty input it must be false
|
// With empty input it must be false
|
||||||
|
@ -239,9 +247,9 @@ class SendTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: .placeholder,
|
initialState: .placeholder,
|
||||||
reducer: SendFlowReducer()
|
reducer: SendFlowReducer()
|
||||||
)
|
) {
|
||||||
|
$0.derivationTool = .noOp
|
||||||
store.dependencies.derivationTool = .noOp
|
}
|
||||||
|
|
||||||
// Checks the computed property `isInvalidAddressFormat` which controls the error message to be shown on the screen
|
// Checks the computed property `isInvalidAddressFormat` which controls the error message to be shown on the screen
|
||||||
// With empty input it must be false
|
// With empty input it must be false
|
||||||
|
@ -257,7 +265,7 @@ class SendTests: XCTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testFundsSufficiency() throws {
|
func testFundsSufficiency_SufficientAmount() throws {
|
||||||
let sendState = SendFlowReducer.State(
|
let sendState = SendFlowReducer.State(
|
||||||
addMemoState: true,
|
addMemoState: true,
|
||||||
memoState: .placeholder,
|
memoState: .placeholder,
|
||||||
|
@ -277,10 +285,10 @@ class SendTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: sendState,
|
initialState: sendState,
|
||||||
reducer: SendFlowReducer()
|
reducer: SendFlowReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.numberFormatter = .noOp
|
||||||
store.dependencies.numberFormatter = .noOp
|
dependencies.numberFormatter.number = { _ in NSNumber(0.00501299) }
|
||||||
store.dependencies.numberFormatter.number = { _ in NSNumber(0.00501299) }
|
}
|
||||||
|
|
||||||
store.send(.transactionAmountInput(.textField(.set("0.00501299")))) { state in
|
store.send(.transactionAmountInput(.textField(.set("0.00501299")))) { state in
|
||||||
state.transactionAmountInputState.textFieldState.text = "0.00501299"
|
state.transactionAmountInputState.textFieldState.text = "0.00501299"
|
||||||
|
@ -294,8 +302,32 @@ class SendTests: XCTestCase {
|
||||||
store.receive(.transactionAmountInput(.updateAmount)) { state in
|
store.receive(.transactionAmountInput(.updateAmount)) { state in
|
||||||
state.transactionAmountInputState.amount = 501_299
|
state.transactionAmountInputState.amount = 501_299
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
store.dependencies.numberFormatter.number = { _ in NSNumber(0.00501301) }
|
func testFundsSufficiency_InsufficientAmount() throws {
|
||||||
|
let sendState = SendFlowReducer.State(
|
||||||
|
addMemoState: true,
|
||||||
|
memoState: .placeholder,
|
||||||
|
transactionAddressInputState: .placeholder,
|
||||||
|
transactionAmountInputState:
|
||||||
|
TransactionAmountTextFieldReducer.State(
|
||||||
|
currencySelectionState: CurrencySelectionReducer.State(),
|
||||||
|
maxValue: 501_300,
|
||||||
|
textFieldState:
|
||||||
|
TCATextFieldReducer.State(
|
||||||
|
validationType: .customFloatingPoint(usNumberFormatter),
|
||||||
|
text: ""
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
let store = TestStore(
|
||||||
|
initialState: sendState,
|
||||||
|
reducer: SendFlowReducer()
|
||||||
|
) { dependencies in
|
||||||
|
dependencies.numberFormatter = .noOp
|
||||||
|
dependencies.numberFormatter.number = { _ in NSNumber(0.00501301) }
|
||||||
|
}
|
||||||
|
|
||||||
store.send(.transactionAmountInput(.textField(.set("0.00501301")))) { state in
|
store.send(.transactionAmountInput(.textField(.set("0.00501301")))) { state in
|
||||||
state.transactionAmountInputState.textFieldState.text = "0.00501301"
|
state.transactionAmountInputState.textFieldState.text = "0.00501301"
|
||||||
|
@ -351,10 +383,10 @@ class SendTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: sendState,
|
initialState: sendState,
|
||||||
reducer: SendFlowReducer()
|
reducer: SendFlowReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.derivationTool = .noOp
|
||||||
store.dependencies.derivationTool = .noOp
|
dependencies.derivationTool.isValidZcashAddress = { _ in true }
|
||||||
store.dependencies.derivationTool.isValidZcashAddress = { _ in true }
|
}
|
||||||
|
|
||||||
store.send(.transactionAddressInput(.textField(.set("t1gXqfSSQt6WfpwyuCU3Wi7sSVZ66DYQ3Po")))) { state in
|
store.send(.transactionAddressInput(.textField(.set("t1gXqfSSQt6WfpwyuCU3Wi7sSVZ66DYQ3Po")))) { state in
|
||||||
state.transactionAddressInputState.textFieldState.text = "t1gXqfSSQt6WfpwyuCU3Wi7sSVZ66DYQ3Po"
|
state.transactionAddressInputState.textFieldState.text = "t1gXqfSSQt6WfpwyuCU3Wi7sSVZ66DYQ3Po"
|
||||||
|
@ -389,10 +421,10 @@ class SendTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: sendState,
|
initialState: sendState,
|
||||||
reducer: SendFlowReducer()
|
reducer: SendFlowReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.derivationTool = .noOp
|
||||||
store.dependencies.derivationTool = .noOp
|
dependencies.derivationTool.isValidZcashAddress = { _ in true }
|
||||||
store.dependencies.derivationTool.isValidZcashAddress = { _ in true }
|
}
|
||||||
|
|
||||||
store.send(.transactionAddressInput(.textField(.set("t1gXqfSSQt6WfpwyuCU3Wi7sSVZ66DYQ3Po")))) { state in
|
store.send(.transactionAddressInput(.textField(.set("t1gXqfSSQt6WfpwyuCU3Wi7sSVZ66DYQ3Po")))) { state in
|
||||||
state.transactionAddressInputState.textFieldState.text = "t1gXqfSSQt6WfpwyuCU3Wi7sSVZ66DYQ3Po"
|
state.transactionAddressInputState.textFieldState.text = "t1gXqfSSQt6WfpwyuCU3Wi7sSVZ66DYQ3Po"
|
||||||
|
@ -427,9 +459,9 @@ class SendTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: sendState,
|
initialState: sendState,
|
||||||
reducer: SendFlowReducer()
|
reducer: SendFlowReducer()
|
||||||
)
|
) {
|
||||||
|
$0.derivationTool = .noOp
|
||||||
store.dependencies.derivationTool = .noOp
|
}
|
||||||
|
|
||||||
store.send(.transactionAddressInput(.textField(.set("3HRG769ii3HDSJV5vNknQPzXqtL2mTSGnr")))) { state in
|
store.send(.transactionAddressInput(.textField(.set("3HRG769ii3HDSJV5vNknQPzXqtL2mTSGnr")))) { state in
|
||||||
state.transactionAddressInputState.textFieldState.text = "3HRG769ii3HDSJV5vNknQPzXqtL2mTSGnr"
|
state.transactionAddressInputState.textFieldState.text = "3HRG769ii3HDSJV5vNknQPzXqtL2mTSGnr"
|
||||||
|
@ -464,10 +496,10 @@ class SendTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: sendState,
|
initialState: sendState,
|
||||||
reducer: SendFlowReducer()
|
reducer: SendFlowReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.derivationTool = .noOp
|
||||||
store.dependencies.derivationTool = .noOp
|
dependencies.derivationTool.isValidZcashAddress = { _ in true }
|
||||||
store.dependencies.derivationTool.isValidZcashAddress = { _ in true }
|
}
|
||||||
|
|
||||||
store.send(.transactionAddressInput(.textField(.set("tmGh6ttAnQRJra81moqYcedFadW9XtUT5Eq")))) { state in
|
store.send(.transactionAddressInput(.textField(.set("tmGh6ttAnQRJra81moqYcedFadW9XtUT5Eq")))) { state in
|
||||||
state.transactionAddressInputState.textFieldState.text = "tmGh6ttAnQRJra81moqYcedFadW9XtUT5Eq"
|
state.transactionAddressInputState.textFieldState.text = "tmGh6ttAnQRJra81moqYcedFadW9XtUT5Eq"
|
||||||
|
|
|
@ -34,10 +34,10 @@ class TransactionAmountTextFieldTests: XCTestCase {
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
reducer: TransactionAmountTextFieldReducer()
|
reducer: TransactionAmountTextFieldReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.numberFormatter.string = { self.usNumberFormatter.string(from: $0) }
|
||||||
store.dependencies.numberFormatter.string = { self.usNumberFormatter.string(from: $0) }
|
dependencies.numberFormatter.number = { self.usNumberFormatter.number(from: $0) }
|
||||||
store.dependencies.numberFormatter.number = { self.usNumberFormatter.number(from: $0) }
|
}
|
||||||
|
|
||||||
store.send(.setMax) { state in
|
store.send(.setMax) { state in
|
||||||
state.textFieldState.text = "0.00501301"
|
state.textFieldState.text = "0.00501301"
|
||||||
|
@ -85,10 +85,10 @@ class TransactionAmountTextFieldTests: XCTestCase {
|
||||||
zecPrice: 1000.0
|
zecPrice: 1000.0
|
||||||
),
|
),
|
||||||
reducer: TransactionAmountTextFieldReducer()
|
reducer: TransactionAmountTextFieldReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.numberFormatter.string = { self.usNumberFormatter.string(from: $0) }
|
||||||
store.dependencies.numberFormatter.string = { self.usNumberFormatter.string(from: $0) }
|
dependencies.numberFormatter.number = { self.usNumberFormatter.number(from: $0) }
|
||||||
store.dependencies.numberFormatter.number = { self.usNumberFormatter.number(from: $0) }
|
}
|
||||||
|
|
||||||
store.send(.currencySelection(.swapCurrencyType)) { state in
|
store.send(.currencySelection(.swapCurrencyType)) { state in
|
||||||
state.textFieldState.text = "1,000"
|
state.textFieldState.text = "1,000"
|
||||||
|
@ -116,10 +116,10 @@ class TransactionAmountTextFieldTests: XCTestCase {
|
||||||
zecPrice: 1000.0
|
zecPrice: 1000.0
|
||||||
),
|
),
|
||||||
reducer: TransactionAmountTextFieldReducer()
|
reducer: TransactionAmountTextFieldReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.numberFormatter.string = { self.usNumberFormatter.string(from: $0) }
|
||||||
store.dependencies.numberFormatter.string = { self.usNumberFormatter.string(from: $0) }
|
dependencies.numberFormatter.number = { self.usNumberFormatter.number(from: $0) }
|
||||||
store.dependencies.numberFormatter.number = { self.usNumberFormatter.number(from: $0) }
|
}
|
||||||
|
|
||||||
store.send(.currencySelection(.swapCurrencyType)) { state in
|
store.send(.currencySelection(.swapCurrencyType)) { state in
|
||||||
state.textFieldState.text = "25,000,000"
|
state.textFieldState.text = "25,000,000"
|
||||||
|
@ -147,10 +147,10 @@ class TransactionAmountTextFieldTests: XCTestCase {
|
||||||
zecPrice: 1000.0
|
zecPrice: 1000.0
|
||||||
),
|
),
|
||||||
reducer: TransactionAmountTextFieldReducer()
|
reducer: TransactionAmountTextFieldReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.numberFormatter.string = { self.usNumberFormatter.string(from: $0) }
|
||||||
store.dependencies.numberFormatter.string = { self.usNumberFormatter.string(from: $0) }
|
dependencies.numberFormatter.number = { self.usNumberFormatter.number(from: $0) }
|
||||||
store.dependencies.numberFormatter.number = { self.usNumberFormatter.number(from: $0) }
|
}
|
||||||
|
|
||||||
store.send(.currencySelection(.swapCurrencyType)) { state in
|
store.send(.currencySelection(.swapCurrencyType)) { state in
|
||||||
state.textFieldState.text = "1"
|
state.textFieldState.text = "1"
|
||||||
|
@ -179,10 +179,10 @@ class TransactionAmountTextFieldTests: XCTestCase {
|
||||||
zecPrice: 1000.0
|
zecPrice: 1000.0
|
||||||
),
|
),
|
||||||
reducer: TransactionAmountTextFieldReducer()
|
reducer: TransactionAmountTextFieldReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.numberFormatter.string = { self.usNumberFormatter.string(from: $0) }
|
||||||
store.dependencies.numberFormatter.string = { self.usNumberFormatter.string(from: $0) }
|
dependencies.numberFormatter.number = { self.usNumberFormatter.number(from: $0) }
|
||||||
store.dependencies.numberFormatter.number = { self.usNumberFormatter.number(from: $0) }
|
}
|
||||||
|
|
||||||
store.send(.textField(.set("1 000"))) { state in
|
store.send(.textField(.set("1 000"))) { state in
|
||||||
state.textFieldState.text = "1 000"
|
state.textFieldState.text = "1 000"
|
||||||
|
@ -220,10 +220,10 @@ class TransactionAmountTextFieldTests: XCTestCase {
|
||||||
zecPrice: 1000.0
|
zecPrice: 1000.0
|
||||||
),
|
),
|
||||||
reducer: TransactionAmountTextFieldReducer()
|
reducer: TransactionAmountTextFieldReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.numberFormatter.string = { self.usNumberFormatter.string(from: $0) }
|
||||||
store.dependencies.numberFormatter.string = { self.usNumberFormatter.string(from: $0) }
|
dependencies.numberFormatter.number = { self.usNumberFormatter.number(from: $0) }
|
||||||
store.dependencies.numberFormatter.number = { self.usNumberFormatter.number(from: $0) }
|
}
|
||||||
|
|
||||||
store.send(.setMax) { state in
|
store.send(.setMax) { state in
|
||||||
state.textFieldState.text = "2"
|
state.textFieldState.text = "2"
|
||||||
|
@ -251,10 +251,10 @@ class TransactionAmountTextFieldTests: XCTestCase {
|
||||||
zecPrice: 1000.0
|
zecPrice: 1000.0
|
||||||
),
|
),
|
||||||
reducer: TransactionAmountTextFieldReducer()
|
reducer: TransactionAmountTextFieldReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.numberFormatter.string = { self.usNumberFormatter.string(from: $0) }
|
||||||
store.dependencies.numberFormatter.string = { self.usNumberFormatter.string(from: $0) }
|
dependencies.numberFormatter.number = { self.usNumberFormatter.number(from: $0) }
|
||||||
store.dependencies.numberFormatter.number = { self.usNumberFormatter.number(from: $0) }
|
}
|
||||||
|
|
||||||
store.send(.setMax) { state in
|
store.send(.setMax) { state in
|
||||||
state.textFieldState.text = "2,000"
|
state.textFieldState.text = "2,000"
|
||||||
|
|
|
@ -47,12 +47,12 @@ class SettingsTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: SettingsReducer.State(phraseDisplayState: RecoveryPhraseDisplayReducer.State(phrase: nil)),
|
initialState: SettingsReducer.State(phraseDisplayState: RecoveryPhraseDisplayReducer.State(phrase: nil)),
|
||||||
reducer: SettingsReducer()
|
reducer: SettingsReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.localAuthentication = .mockAuthenticationSucceeded
|
||||||
store.dependencies.localAuthentication = .mockAuthenticationSucceeded
|
dependencies.mnemonic = .noOp
|
||||||
store.dependencies.mnemonic = .noOp
|
dependencies.mnemonic.asWords = { _ in mnemonic.components(separatedBy: " ") }
|
||||||
store.dependencies.mnemonic.asWords = { _ in mnemonic.components(separatedBy: " ") }
|
dependencies.walletStorage = mockedWalletStorage
|
||||||
store.dependencies.walletStorage = mockedWalletStorage
|
}
|
||||||
|
|
||||||
_ = await store.send(.backupWalletAccessRequest)
|
_ = await store.send(.backupWalletAccessRequest)
|
||||||
|
|
||||||
|
@ -68,9 +68,9 @@ class SettingsTests: XCTestCase {
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: .placeholder,
|
initialState: .placeholder,
|
||||||
reducer: SettingsReducer()
|
reducer: SettingsReducer()
|
||||||
)
|
) {
|
||||||
|
$0.localAuthentication = .mockAuthenticationFailed
|
||||||
store.dependencies.localAuthentication = .mockAuthenticationFailed
|
}
|
||||||
|
|
||||||
_ = await store.send(.backupWalletAccessRequest)
|
_ = await store.send(.backupWalletAccessRequest)
|
||||||
|
|
||||||
|
|
|
@ -76,10 +76,10 @@ class WalletEventsTests: XCTestCase {
|
||||||
walletEvents: identifiedWalletEvents
|
walletEvents: identifiedWalletEvents
|
||||||
),
|
),
|
||||||
reducer: WalletEventsFlowReducer()
|
reducer: WalletEventsFlowReducer()
|
||||||
)
|
) { dependencies in
|
||||||
|
dependencies.mainQueue = Self.testScheduler.eraseToAnyScheduler()
|
||||||
store.dependencies.mainQueue = Self.testScheduler.eraseToAnyScheduler()
|
dependencies.sdkSynchronizer = SDKSynchronizerDependency.mock
|
||||||
store.dependencies.sdkSynchronizer = SDKSynchronizerDependency.mock
|
}
|
||||||
|
|
||||||
store.send(.synchronizerStateChanged(.synced))
|
store.send(.synchronizerStateChanged(.synced))
|
||||||
|
|
||||||
|
@ -99,6 +99,8 @@ class WalletEventsTests: XCTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testCopyToPasteboard() throws {
|
func testCopyToPasteboard() throws {
|
||||||
|
let testPasteboard = PasteboardClient.testPasteboard
|
||||||
|
|
||||||
let store = TestStore(
|
let store = TestStore(
|
||||||
initialState: WalletEventsFlowReducer.State(
|
initialState: WalletEventsFlowReducer.State(
|
||||||
route: .latest,
|
route: .latest,
|
||||||
|
@ -106,15 +108,15 @@ class WalletEventsTests: XCTestCase {
|
||||||
walletEvents: []
|
walletEvents: []
|
||||||
),
|
),
|
||||||
reducer: WalletEventsFlowReducer()
|
reducer: WalletEventsFlowReducer()
|
||||||
)
|
) {
|
||||||
|
$0.pasteboard = testPasteboard
|
||||||
store.dependencies.pasteboard = .testPasteboard
|
}
|
||||||
|
|
||||||
let testText = "test text"
|
let testText = "test text"
|
||||||
store.send(.copyToPastboard(testText))
|
store.send(.copyToPastboard(testText))
|
||||||
|
|
||||||
XCTAssertEqual(
|
XCTAssertEqual(
|
||||||
store.dependencies.pasteboard.getString(),
|
testPasteboard.getString(),
|
||||||
testText,
|
testText,
|
||||||
"WalletEvetns: `testCopyToPasteboard` is expected to match the input `\(testText)`"
|
"WalletEvetns: `testCopyToPasteboard` is expected to match the input `\(testText)`"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue