Skip to content

[EACQAPW-5661]: Implement ExternalRequestBuilderTests #487

Merged
merged 2 commits into from
Jul 25, 2023
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
* [EACQAPW-5588] Added UITests target and added tests utils methods
* [EACQAPW-5626] AcquiringRequestBuilder Tests
* [EACQAPW-5651] DeviceInfoProvder Tests
* [EACQAPW-5661] ExternalRequestBuilder Tests

### Fixed

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//
// ExternalRequestBuilderTests.swift
// TinkoffASDKCore-Unit-Tests
//
// Created by Никита Васильев on 25.07.2023.
//

@testable import TinkoffASDKCore
import XCTest

final class ExternalRequestBuilderTests: XCTestCase {
// MARK: Properties

private var urlProviderMock: URLProviderMock!
private var sut: ExternalRequestBuilder!

// MARK: Initialization

override func setUp() {
super.setUp()
urlProviderMock = URLProviderMock()
sut = ExternalRequestBuilder(appBasedConfigURLProvider: urlProviderMock)
}

override func tearDown() {
urlProviderMock = nil
sut = nil
super.tearDown()
}

// MARK: Tests

func test_get3DSAppBasedConfigRequest() throws {
// given
urlProviderMock.underlyingUrl = .doesNotMatter

// when
let request = sut.get3DSAppBasedConfigRequest()

// then
let configRequest = try (XCTUnwrap(request as? Get3DSAppBasedCertsConfigRequest))
XCTAssertEqual(configRequest.baseURL.absoluteString, URL.doesNotMatter.absoluteString)
}

func test_getSBPBanks() throws {
// when
let request = sut.getSBPBanks()

// then
let configRequest = try (XCTUnwrap(request as? GetSBPBanksRequest))
XCTAssertEqual(configRequest.baseURL.absoluteString, "https://qr.nspk.ru")
XCTAssertEqual(configRequest.httpMethod, .get)
}
}
Loading