-
Notifications
You must be signed in to change notification settings - Fork 2
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
6ed8559
commit 0c9056e
Showing
21 changed files
with
1,144 additions
and
171 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
55 changes: 0 additions & 55 deletions
55
packages/example/ios/example_0_70_6Tests/CodableExtensionsTests.swift
This file was deleted.
Oops, something went wrong.
105 changes: 105 additions & 0 deletions
105
...os/example_0_70_6Tests/DataModelsTests/Banks Component/RNTBanksCollectableDataTests.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,105 @@ | ||
// | ||
// RNTBanksCollectableDataTests.swift | ||
// example_0_70_6Tests | ||
// | ||
// Created by Boris on 23.5.24.. | ||
// | ||
|
||
import XCTest | ||
@testable import primer_io_react_native | ||
import PrimerSDK | ||
|
||
class BanksCollectableDataRNTests: XCTestCase { | ||
|
||
func testFilterRNInitialization() { | ||
let filter = FilterRN(text: "filterText") | ||
XCTAssertEqual(filter.validatableDataName, "bankListFilter") | ||
XCTAssertEqual(filter.text, "filterText") | ||
} | ||
|
||
func testBankIdRNInitialization() { | ||
let bankId = BankIdRN(id: "bankId123") | ||
XCTAssertEqual(bankId.validatableDataName, "bankId") | ||
XCTAssertEqual(bankId.id, "bankId123") | ||
} | ||
|
||
func testBanksCollectableDataToBankIdRN() { | ||
let bankData = BanksCollectableData.bankId(bankId: "bankId123") | ||
let bankIdRN: BankIdRN? | ||
|
||
switch bankData { | ||
case .bankId(let bankId): | ||
bankIdRN = BankIdRN(id: bankId) | ||
default: | ||
bankIdRN = nil | ||
} | ||
|
||
if let bankIdRN = bankIdRN { | ||
XCTAssertEqual(bankIdRN.validatableDataName, "bankId") | ||
XCTAssertEqual(bankIdRN.id, "bankId123") | ||
} else { | ||
XCTFail("Conversion to BankIdRN failed") | ||
} | ||
} | ||
|
||
func testBanksCollectableDataToFilterRN() { | ||
let filterData = BanksCollectableData.bankFilterText(text: "filterText") | ||
let filterRN: FilterRN? | ||
|
||
switch filterData { | ||
case .bankFilterText(let text): | ||
filterRN = FilterRN(text: text) | ||
default: | ||
filterRN = nil | ||
} | ||
|
||
if let filterRN = filterRN { | ||
XCTAssertEqual(filterRN.validatableDataName, "bankListFilter") | ||
XCTAssertEqual(filterRN.text, "filterText") | ||
} else { | ||
XCTFail("Conversion to FilterRN failed") | ||
} | ||
} | ||
|
||
func testFilterRNEncoding() { | ||
let filter = FilterRN(text: "filterText") | ||
let encoder = JSONEncoder() | ||
do { | ||
let data = try encoder.encode(filter) | ||
let jsonString = String(data: data, encoding: .utf8) | ||
XCTAssertNotNil(jsonString) | ||
} catch { | ||
XCTFail("Encoding failed: \(error)") | ||
} | ||
} | ||
|
||
func testBankIdRNEncoding() { | ||
let bankId = BankIdRN(id: "bankId123") | ||
let encoder = JSONEncoder() | ||
do { | ||
let data = try encoder.encode(bankId) | ||
let jsonString = String(data: data, encoding: .utf8) | ||
XCTAssertNotNil(jsonString) | ||
} catch { | ||
XCTFail("Encoding failed: \(error)") | ||
} | ||
} | ||
|
||
func testBanksCollectableDataEncoding() { | ||
let bankIdData = BanksCollectableData.bankId(bankId: "bankId123") | ||
let filterData = BanksCollectableData.bankFilterText(text: "filterText") | ||
let encoder = JSONEncoder() | ||
|
||
do { | ||
let bankIdDataEncoded = try encoder.encode(bankIdData) | ||
let bankIdJsonString = String(data: bankIdDataEncoded, encoding: .utf8) | ||
XCTAssertNotNil(bankIdJsonString) | ||
|
||
let filterDataEncoded = try encoder.encode(filterData) | ||
let filterJsonString = String(data: filterDataEncoded, encoding: .utf8) | ||
XCTAssertNotNil(filterJsonString) | ||
} catch { | ||
XCTFail("Encoding failed: \(error)") | ||
} | ||
} | ||
} |
Oops, something went wrong.