-
Notifications
You must be signed in to change notification settings - Fork 5
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
9f21980
commit 8685a3d
Showing
9 changed files
with
95 additions
and
14 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
11 changes: 7 additions & 4 deletions
11
Packages/Keystore/Tests/KeystoreTests/Chain+KeystoreTests.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 |
---|---|---|
@@ -1,13 +1,16 @@ | ||
// Copyright (c). Gem Wallet. All rights reserved. | ||
|
||
import XCTest | ||
import Primitives | ||
import PrimitivesTestKit | ||
|
||
final class Chain_KeystoreTests: XCTestCase { | ||
|
||
func testIsValidAddress() { | ||
XCTAssertTrue(Chain.ethereum.isValidAddress("0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5")) | ||
XCTAssertTrue(Chain.ethereum.isValidAddress("0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5")) | ||
XCTAssertTrue(Chain.mock(.ethereum).isValidAddress("0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5")) | ||
XCTAssertTrue(Chain.mock(.ethereum).isValidAddress("0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5")) | ||
|
||
XCTAssertFalse(Chain.ethereum.isValidAddress("0x123")) | ||
XCTAssertFalse(Chain.ethereum.isValidAddress("0x123")) | ||
XCTAssertFalse(Chain.mock(.ethereum).isValidAddress("0x123")) | ||
XCTAssertFalse(Chain.mock(.ethereum).isValidAddress("0x123")) | ||
} | ||
} |
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
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,12 @@ | ||
// Copyright (c). Gem Wallet. All rights reserved. | ||
|
||
import Foundation | ||
import Primitives | ||
|
||
public extension Chain { | ||
static func mock( | ||
_ chain: Chain = Chain.bitcoin | ||
) -> Chain { | ||
chain | ||
} | ||
} |
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,16 @@ | ||
// Copyright (c). Gem Wallet. All rights reserved. | ||
|
||
import Foundation | ||
import Primitives | ||
|
||
//public extension Wallet { | ||
// static func mock() -> Wallet { | ||
// Wallet( | ||
// id: <#T##String#>, | ||
// name: <#T##String#>, | ||
// index: <#T##Int32#>, | ||
// type: <#T##WalletType#>, | ||
// accounts: <#T##[Account]#> | ||
// ) | ||
// } | ||
//} |
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
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,12 @@ | ||
// Copyright (c). Gem Wallet. All rights reserved. | ||
|
||
import Foundation | ||
import Store | ||
|
||
public extension PreferencesStore { | ||
static func mock( | ||
defaults: UserDefaults = .mock() | ||
) -> PreferencesStore { | ||
PreferencesStore(defaults: defaults) | ||
} | ||
} |
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,12 @@ | ||
// Copyright (c). Gem Wallet. All rights reserved. | ||
|
||
import Foundation | ||
import Store | ||
|
||
public extension UserDefaults { | ||
static func mock( | ||
suiteName: String = UUID().uuidString | ||
) -> UserDefaults { | ||
UserDefaults(suiteName: suiteName)! | ||
} | ||
} |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
// Copyright (c). Gem Wallet. All rights reserved. | ||
|
||
import XCTest | ||
@testable import Store | ||
import StoreTestKit | ||
|
||
final class StoreTests: XCTestCase { | ||
func testExample() throws { | ||
// This is an example of a functional test case. | ||
// Use XCTAssert and related functions to verify your tests produce the correct | ||
// results. | ||
//XCTAssertEqual(Store().text, "Hello, World!") | ||
XCTAssertNotNil(PreferencesStore.mock()) | ||
} | ||
} |