-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: ios: add unit tests for Settings and Backup Select Key view mo…
…dels
- Loading branch information
Showing
15 changed files
with
280 additions
and
25 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
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
File renamed without changes.
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
80 changes: 80 additions & 0 deletions
80
ios/PolkadotVaultTests/Models+Generate/MNetworkDetails+Generate.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,80 @@ | ||
// | ||
// MNetworkDetails+Generate.swift | ||
// PolkadotVaultTests | ||
// | ||
// Created by Krzysztof Rodak on 08/01/2024. | ||
// | ||
|
||
import Foundation | ||
@testable import PolkadotVault | ||
|
||
extension MNetworkDetails { | ||
static func generate( | ||
base58prefix: UInt16 = 0, | ||
color: String = "defaultColor", | ||
decimals: UInt8 = 0, | ||
encryption: Encryption = .sr25519, | ||
genesisHash: H256 = [], | ||
logo: String = "defaultLogo", | ||
name: String = "Default Name", | ||
order: String = "defaultOrder", | ||
pathId: String = "defaultPathId", | ||
secondaryColor: String = "defaultSecondaryColor", | ||
title: String = "Default Title", | ||
unit: String = "defaultUnit", | ||
currentVerifier: MVerifier = .generate(), | ||
meta: [MMetadataRecord] = [.generate()] | ||
) -> MNetworkDetails { | ||
MNetworkDetails( | ||
base58prefix: base58prefix, | ||
color: color, | ||
decimals: decimals, | ||
encryption: encryption, | ||
genesisHash: genesisHash, | ||
logo: logo, | ||
name: name, | ||
order: order, | ||
pathId: pathId, | ||
secondaryColor: secondaryColor, | ||
title: title, | ||
unit: unit, | ||
currentVerifier: currentVerifier, | ||
meta: meta | ||
) | ||
} | ||
} | ||
|
||
extension MVerifier { | ||
static func generate( | ||
ttype: String = "defaultType", | ||
details: MVerifierDetails = .generate() | ||
) -> MVerifier { | ||
MVerifier(ttype: ttype, details: details) | ||
} | ||
} | ||
|
||
extension MVerifierDetails { | ||
static func generate( | ||
publicKey: String = "defaultPublicKey", | ||
identicon: Identicon = .generate(), | ||
encryption: String = "defaultEncryption" | ||
) -> MVerifierDetails { | ||
MVerifierDetails(publicKey: publicKey, identicon: identicon, encryption: encryption) | ||
} | ||
} | ||
|
||
extension MMetadataRecord { | ||
static func generate( | ||
specname: String = "defaultSpecName", | ||
specsVersion: String = "defaultSpecsVersion", | ||
metaHash: String = "defaultMetaHash", | ||
metaIdPic: Identicon = .generate() | ||
) -> MMetadataRecord { | ||
MMetadataRecord( | ||
specname: specname, | ||
specsVersion: specsVersion, | ||
metaHash: metaHash, | ||
metaIdPic: metaIdPic | ||
) | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
ios/PolkadotVaultTests/Models+Generate/MmNetwork+Generate.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,21 @@ | ||
// | ||
// MmNetwork+Generate.swift | ||
// PolkadotVaultTests | ||
// | ||
// Created by Krzysztof Rodak on 08/01/2024. | ||
// | ||
|
||
import Foundation | ||
@testable import PolkadotVault | ||
|
||
extension MmNetwork { | ||
static func generate( | ||
key: String = "defaultKey", | ||
title: String = "Default Title", | ||
logo: String = "defaultLogo", | ||
order: UInt8 = 0, | ||
pathId: String = "defaultPathId" | ||
) -> MmNetwork { | ||
MmNetwork(key: key, title: title, logo: logo, order: order, pathId: pathId) | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.