Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nickybondarenko committed Jul 16, 2024
1 parent 850bce5 commit acf30be
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 18 deletions.
20 changes: 10 additions & 10 deletions Tests/ConfidenceTests/ConfidenceContextTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ final class ConfidenceContextTests: XCTestCase {
func testWithContext() {
let client = RemoteConfidenceResolveClient(
options: ConfidenceClientOptions(
credentials: ConfidenceClientCredentials.clientSecret(secret: "")),
credentials: ConfidenceClientCredentials.clientSecret(secret: ""), timeoutIntervalForRequest: 10),
session: MockedClientURLProtocol.mockedSession(),
metadata: ConfidenceMetadata(name: "", version: ""))

Expand All @@ -33,7 +33,7 @@ final class ConfidenceContextTests: XCTestCase {
func testWithContextUpdateParent() {
let client = RemoteConfidenceResolveClient(
options: ConfidenceClientOptions(
credentials: ConfidenceClientCredentials.clientSecret(secret: "")),
credentials: ConfidenceClientCredentials.clientSecret(secret: ""), timeoutIntervalForRequest: 10),
session: MockedClientURLProtocol.mockedSession(),
metadata: ConfidenceMetadata(name: "", version: ""))

Expand Down Expand Up @@ -65,7 +65,7 @@ final class ConfidenceContextTests: XCTestCase {
func testUpdateLocalContext() {
let client = RemoteConfidenceResolveClient(
options: ConfidenceClientOptions(
credentials: ConfidenceClientCredentials.clientSecret(secret: "")),
credentials: ConfidenceClientCredentials.clientSecret(secret: ""), timeoutIntervalForRequest: 10),
session: MockedClientURLProtocol.mockedSession(),
metadata: ConfidenceMetadata(name: "", version: ""))

Expand All @@ -92,7 +92,7 @@ final class ConfidenceContextTests: XCTestCase {
func testUpdateLocalContextWithoutOverride() {
let client = RemoteConfidenceResolveClient(
options: ConfidenceClientOptions(
credentials: ConfidenceClientCredentials.clientSecret(secret: "")),
credentials: ConfidenceClientCredentials.clientSecret(secret: ""), timeoutIntervalForRequest: 10),
session: MockedClientURLProtocol.mockedSession(),
metadata: ConfidenceMetadata(name: "", version: ""))

Expand Down Expand Up @@ -123,7 +123,7 @@ final class ConfidenceContextTests: XCTestCase {
func testUpdateParentContextWithOverride() {
let client = RemoteConfidenceResolveClient(
options: ConfidenceClientOptions(
credentials: ConfidenceClientCredentials.clientSecret(secret: "")),
credentials: ConfidenceClientCredentials.clientSecret(secret: ""), timeoutIntervalForRequest: 10),
session: MockedClientURLProtocol.mockedSession(),
metadata: ConfidenceMetadata(name: "", version: ""))

Expand Down Expand Up @@ -154,7 +154,7 @@ final class ConfidenceContextTests: XCTestCase {
func testRemoveContextEntry() {
let client = RemoteConfidenceResolveClient(
options: ConfidenceClientOptions(
credentials: ConfidenceClientCredentials.clientSecret(secret: "")),
credentials: ConfidenceClientCredentials.clientSecret(secret: ""), timeoutIntervalForRequest: 10),
session: MockedClientURLProtocol.mockedSession(),
metadata: ConfidenceMetadata(name: "", version: ""))

Expand All @@ -179,7 +179,7 @@ final class ConfidenceContextTests: XCTestCase {
func testRemoveContextEntryFromParent() {
let client = RemoteConfidenceResolveClient(
options: ConfidenceClientOptions(
credentials: ConfidenceClientCredentials.clientSecret(secret: "")),
credentials: ConfidenceClientCredentials.clientSecret(secret: ""), timeoutIntervalForRequest: 10),
session: MockedClientURLProtocol.mockedSession(),
metadata: ConfidenceMetadata(name: "", version: ""))

Expand Down Expand Up @@ -207,7 +207,7 @@ final class ConfidenceContextTests: XCTestCase {
func testRemoveContextEntryFromParentAndChild() {
let client = RemoteConfidenceResolveClient(
options: ConfidenceClientOptions(
credentials: ConfidenceClientCredentials.clientSecret(secret: "")),
credentials: ConfidenceClientCredentials.clientSecret(secret: ""), timeoutIntervalForRequest: 10),
session: MockedClientURLProtocol.mockedSession(),
metadata: ConfidenceMetadata(name: "", version: ""))

Expand Down Expand Up @@ -238,7 +238,7 @@ final class ConfidenceContextTests: XCTestCase {
func testRemoveContextEntryFromParentAndChildThenUpdate() {
let client = RemoteConfidenceResolveClient(
options: ConfidenceClientOptions(
credentials: ConfidenceClientCredentials.clientSecret(secret: "")),
credentials: ConfidenceClientCredentials.clientSecret(secret: ""), timeoutIntervalForRequest: 10),
session: MockedClientURLProtocol.mockedSession(),
metadata: ConfidenceMetadata(name: "", version: ""))

Expand Down Expand Up @@ -271,7 +271,7 @@ final class ConfidenceContextTests: XCTestCase {
func testVisitorId() {
let client = RemoteConfidenceResolveClient(
options: ConfidenceClientOptions(
credentials: ConfidenceClientCredentials.clientSecret(secret: "")),
credentials: ConfidenceClientCredentials.clientSecret(secret: ""), timeoutIntervalForRequest: 10),
session: MockedClientURLProtocol.mockedSession(),
metadata: ConfidenceMetadata(name: "", version: ""))

Expand Down
10 changes: 8 additions & 2 deletions Tests/ConfidenceTests/EventSenderEngineTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ final class EventSenderEngineTest: XCTestCase {
func testRemoveEventsFromStorageOnBadRequest() throws {
MockedClientURLProtocol.mockedOperation = .badRequest
let badRequestUploader = RemoteConfidenceClient(
options: ConfidenceClientOptions(credentials: ConfidenceClientCredentials.clientSecret(secret: "")),
options: ConfidenceClientOptions(
credentials: ConfidenceClientCredentials.clientSecret(secret: ""),
timeoutIntervalForRequest: 10
),
session: MockedClientURLProtocol.mockedSession(),
metadata: ConfidenceMetadata(name: "", version: ""))

Expand All @@ -135,7 +138,10 @@ final class EventSenderEngineTest: XCTestCase {
func testKeepEventsInStorageForRetry() throws {
MockedClientURLProtocol.mockedOperation = .needRetryLater
let retryLaterUploader = RemoteConfidenceClient(
options: ConfidenceClientOptions(credentials: ConfidenceClientCredentials.clientSecret(secret: "")),
options: ConfidenceClientOptions(
credentials: ConfidenceClientCredentials.clientSecret(secret: ""),
timeoutIntervalForRequest: 10
),
session: MockedClientURLProtocol.mockedSession(),
metadata: ConfidenceMetadata(name: "", version: ""))

Expand Down
5 changes: 4 additions & 1 deletion Tests/ConfidenceTests/FlagApplierWithRetriesTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import XCTest

@available(macOS 13.0, iOS 16.0, *)
class FlagApplierWithRetriesTest: XCTestCase {
private let options = ConfidenceClientOptions(credentials: .clientSecret(secret: "test"))
private let options = ConfidenceClientOptions(
credentials: .clientSecret(secret: "test"),
timeoutIntervalForRequest: 10
)
private var storage = StorageMock()
private var httpClient = HttpClientMock()
private let metadata = ConfidenceMetadata(name: "test-provider-name", version: "0.0.0.")
Expand Down
8 changes: 4 additions & 4 deletions Tests/ConfidenceTests/RemoteConfidenceClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class RemoteConfidenceClientTest: XCTestCase {
func testUploadDoesntThrow() async throws {
let client = RemoteConfidenceClient(
options: ConfidenceClientOptions(
credentials: ConfidenceClientCredentials.clientSecret(secret: "")),
credentials: ConfidenceClientCredentials.clientSecret(secret: ""), timeoutIntervalForRequest: 10),
session: MockedClientURLProtocol.mockedSession(),
metadata: ConfidenceMetadata(name: "", version: ""))

Expand All @@ -29,7 +29,7 @@ class RemoteConfidenceClientTest: XCTestCase {
func testUploadEmptyEventsDoesntThrow() async throws {
let client = RemoteConfidenceClient(
options: ConfidenceClientOptions(
credentials: ConfidenceClientCredentials.clientSecret(secret: "")),
credentials: ConfidenceClientCredentials.clientSecret(secret: ""), timeoutIntervalForRequest: 10),
session: MockedClientURLProtocol.mockedSession(),
metadata: ConfidenceMetadata(name: "", version: ""))

Expand All @@ -41,7 +41,7 @@ class RemoteConfidenceClientTest: XCTestCase {
MockedClientURLProtocol.mockedOperation = .firstEventFails
let client = RemoteConfidenceClient(
options: ConfidenceClientOptions(
credentials: ConfidenceClientCredentials.clientSecret(secret: "")),
credentials: ConfidenceClientCredentials.clientSecret(secret: ""), timeoutIntervalForRequest: 10),
session: MockedClientURLProtocol.mockedSession(),
metadata: ConfidenceMetadata(name: "", version: ""))

Expand All @@ -59,7 +59,7 @@ class RemoteConfidenceClientTest: XCTestCase {
MockedClientURLProtocol.mockedOperation = .malformedResponse
let client = RemoteConfidenceClient(
options: ConfidenceClientOptions(
credentials: ConfidenceClientCredentials.clientSecret(secret: "")),
credentials: ConfidenceClientCredentials.clientSecret(secret: ""), timeoutIntervalForRequest: 10),
session: MockedClientURLProtocol.mockedSession(),
metadata: ConfidenceMetadata(name: "", version: ""))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class RemoteResolveConfidenceClientTest: XCTestCase {
let session = MockedResolveClientURLProtocol.mockedSession(flags: flags)

let client = RemoteConfidenceResolveClient(
options: .init(credentials: .clientSecret(secret: "test")),
options: .init(credentials: .clientSecret(secret: "test"), timeoutIntervalForRequest: 10),
session: session,
applyOnResolve: true,
metadata: ConfidenceMetadata(name: "", version: "")
Expand Down

0 comments on commit acf30be

Please sign in to comment.