-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(POM-222): add integration tests infra (#129)
Add infrastructure for integration tests as well as cards service tests
- Loading branch information
1 parent
8438f24
commit 167c026
Showing
21 changed files
with
148 additions
and
51 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
brew "mint" |
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 @@ | ||
../Brewfile |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
mint run swiftgen config run --config "${TARGET_ROOT}/swiftgen.yml" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Empty file.
66 changes: 66 additions & 0 deletions
66
Tests/ProcessOutTests/Sources/Integration/CardsServiceTests.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,66 @@ | ||
// | ||
// CardsServiceTests.swift | ||
// ProcessOutTests | ||
// | ||
// Created by Andrii Vysotskyi on 27.06.2023. | ||
// | ||
|
||
import Foundation | ||
import XCTest | ||
@_spi(PO) import ProcessOut | ||
|
||
final class CardsServiceTests: XCTestCase { | ||
|
||
override func setUp() { | ||
super.setUp() | ||
let configuration = ProcessOutConfiguration.test( | ||
projectId: Constants.projectId, | ||
privateKey: Constants.projectPrivateKey, | ||
apiBaseUrl: URL(string: Constants.apiBaseUrl)!, | ||
checkoutBaseUrl: URL(string: Constants.checkoutBaseUrl)! | ||
) | ||
ProcessOut.configure(configuration: configuration) | ||
sut = ProcessOut.shared.cards | ||
} | ||
|
||
func test_issuerInformation() async throws { | ||
// When | ||
let information = try await sut.issuerInformation(iin: "400012") | ||
|
||
// Then | ||
XCTAssertEqual(information.bankName, "UNITED CITIZENS BANK OF SOUTHERN KENTUCKY") | ||
XCTAssertEqual(information.brand, "visa business") | ||
XCTAssertEqual(information.category, "business") | ||
XCTAssertEqual(information.scheme, "visa") | ||
XCTAssertEqual(information.type, "debit") | ||
} | ||
|
||
func test_issuerInformation_whenIinIsTooShort_throws() async { | ||
do { | ||
// When | ||
_ = try await sut.issuerInformation(iin: "4") | ||
} catch { | ||
return | ||
} | ||
|
||
// Then | ||
XCTFail("IIN with length less than 6 symbols should be invalid") | ||
} | ||
|
||
func test_tokenizeRequest_returnsCard() async throws { | ||
// Given | ||
let request = POCardTokenizationRequest(number: "4242424242424242", expMonth: 12, expYear: 40, cvc: "737") | ||
|
||
// When | ||
let card = try await sut.tokenize(request: request) | ||
|
||
// Then | ||
XCTAssertEqual(card.last4Digits, "4242") | ||
XCTAssertEqual(card.expMonth, 12) | ||
XCTAssertEqual(card.expYear, 2040) | ||
} | ||
|
||
// MARK: - Tests | ||
|
||
private var sut: POCardsService! | ||
} |
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 @@ | ||
input_dir: ${TARGET_ROOT}/Resources/ | ||
output_dir: ${TARGET_ROOT}/Sources/Generated/ | ||
|
||
## Application Constants | ||
yaml: | ||
inputs: | ||
- Constants.yml | ||
outputs: | ||
- templateName: inline-swift5 | ||
params: | ||
enumName: Constants | ||
output: Constants+Generated.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