Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import BitwardenResources
import Foundation
import Testing

Expand All @@ -6,6 +7,13 @@ import Testing
struct BankAccountTypeTests {
// MARK: Tests

/// `defaultValueLocalizedName` is the localized `Select` placeholder shown when no account
/// type is selected.
@Test
func defaultValueLocalizedName_isSelect() {
#expect(BankAccountType.defaultValueLocalizedName == Localizations.select)
}

/// Raw values match the server contract.
@Test
func rawValues_matchServerContract() {
Expand Down
4 changes: 2 additions & 2 deletions BitwardenShared/Core/Vault/Models/Enum/TitleType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ enum TitleType: String, Codable, Equatable, Hashable, Menuable {

// MARK: Type Properties

/// default state title for title type
/// The default placeholder shown when no title is selected.
static var defaultValueLocalizedName: String {
"--\(Localizations.select)--"
Localizations.select
}

var localizedName: String {
Expand Down
15 changes: 15 additions & 0 deletions BitwardenShared/Core/Vault/Models/Enum/TitleTypeTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import BitwardenResources
import Testing

@testable import BitwardenShared

struct TitleTypeTests {
// MARK: Tests

/// `defaultValueLocalizedName` is the localized `Select` placeholder shown when no title is
/// selected.
@Test
func defaultValueLocalizedName_isSelect() {
#expect(TitleType.defaultValueLocalizedName == Localizations.select)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protocol AddEditBankAccountItemState: Equatable, Sendable {
extension BankAccountType: Menuable {
/// The default placeholder shown when no account type is selected.
public static var defaultValueLocalizedName: String {
"--\(Localizations.select)--"
Localizations.select
}

/// A localized string representation of the account type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ extension CardComponent.Brand {

extension CardComponent.Brand: CaseIterable {}
extension CardComponent.Brand: Menuable {
/// default state title for title type
/// The default placeholder shown when no card brand is selected.
static var defaultValueLocalizedName: String {
"--\(Localizations.select)--"
Localizations.select
}

/// Provides a localized string representation of the card brand.
Expand Down Expand Up @@ -290,9 +290,9 @@ extension CardComponent.Brand {

extension CardComponent.Month: CaseIterable {}
extension CardComponent.Month: Menuable {
/// default state title for title type
/// The default placeholder shown when no expiration month is selected.
static var defaultValueLocalizedName: String {
"--\(Localizations.select)--"
Localizations.select
}

var localizedName: String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ import XCTest
class CardComponentBrandTests: BitwardenTestCase {
// MARK: Tests

/// `defaultValueLocalizedName` is the localized `Select` placeholder shown when no brand is
/// selected.
func test_defaultValueLocalizedName() {
XCTAssertEqual(CardComponent.Brand.defaultValueLocalizedName, Localizations.select)
}

/// `getter:icon` returns the appropriate icon for each card brand.
func test_icon() {
XCTAssertEqual(CardComponent.Brand.americanExpress.icon.name, SharedAsset.Icons.Cards.amex.name)
Expand Down Expand Up @@ -280,3 +286,15 @@ class CardComponentBrandTests: BitwardenTestCase {
XCTAssertEqual(CardComponent.Brand.visa.validDigitLengths, [13, 16, 19])
}
}

// MARK: - CardComponentMonthTests

class CardComponentMonthTests: BitwardenTestCase {
// MARK: Tests

/// `defaultValueLocalizedName` is the localized `Select` placeholder shown when no expiration
/// month is selected.
func test_defaultValueLocalizedName() {
XCTAssertEqual(CardComponent.Month.defaultValueLocalizedName, Localizations.select)
}
}
Loading