Skip to content

Commit 9d143cf

Browse files
authored
Merge pull request #303 from cocoatype/283-add-purchase-began-log
Add "purchase began" log
2 parents d7ae717 + c2ddddc commit 9d143cf

35 files changed

+307
-94
lines changed

Modules/Defaults/Tests/UserDefaultsProviderTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
// Copyright © 2025 Cocoatype, LLC. All rights reserved.
33

44
import Foundation
5-
import TestHelpers
65
import Testing
76

7+
import BarcTestHelpers
8+
89
@testable import BarcDefaults
910

1011
struct UserDefaultsProviderTests {

Modules/ErrorHandling/Doubles/StubErrorHandler.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// Copyright © 2023 Cocoatype, LLC. All rights reserved.
33

44
import Foundation
5-
import TestHelpersInterface
65

76
import BarcErrorHandling
7+
import BarcTestHelpersInterface
88

99
public struct StubErrorHandler: ErrorHandler {
1010
public init(

Modules/ErrorHandling/Tests/Sources/StubErrorHandlerTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Created by Geoff Pado on 11/5/23.
22
// Copyright © 2023 Cocoatype, LLC. All rights reserved.
33

4-
import TestHelpers
54
import Testing
65

76
import BarcErrorHandlingDoubles
7+
import BarcTestHelpers
88

99
struct StubErrorHandlerTests {
1010
@MainActor
Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,40 @@
11
// Created by Geoff Pado on 5/16/24.
22
// Copyright © 2024 Cocoatype, LLC. All rights reserved.
33

4-
import TestHelpersInterface
4+
import Synchronization
55

66
import BarcLogging
7+
import BarcTestHelpersInterface
78

8-
public class SpyLogger: Logger {
9+
@available(iOS 18.0, *)
10+
public final class SpyLogger: Logger {
911
public init(
1012
logExpectation: Expectation? = nil
1113
) {
1214
self.logExpectation = logExpectation
1315
}
1416

15-
private(set) public var loggedEvents = [Event]()
16-
public var logExpectation: Expectation?
17+
private let loggedEventsMutex = Mutex([Event]())
18+
public var loggedEvents: [Event] {
19+
get {
20+
return loggedEventsMutex.withLock { $0 }
21+
}
22+
set {
23+
loggedEventsMutex.withLock { $0 = newValue }
24+
}
25+
}
26+
27+
private let expectationMutex = Mutex<Expectation?>(nil)
28+
public var logExpectation: Expectation? {
29+
get {
30+
return expectationMutex.withLock { $0 }
31+
}
32+
set {
33+
expectationMutex.withLock { $0 = newValue }
34+
}
35+
}
1736
public func log(_ event: Event) {
1837
loggedEvents.append(event)
38+
logExpectation?.fulfill()
1939
}
2040
}

Modules/Logging/Sources/Event.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
public struct Event: Sendable {
55
let name: Name
6-
let info: [String: String]
7-
var value: String { String(name.value) }
6+
public let info: [String: String]
7+
public var value: String { String(name.value) }
88

99
public init(name: Name, info: [String: String]) {
1010
self.name = name

Modules/Menu/Sources/Components/SiteURLCell.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Copyright © 2024 Cocoatype, LLC. All rights reserved.
33

44
import SwiftUI
5-
import TestHelpersInterface
65

6+
import BarcTestHelpersInterface
77
import BarcWeb
88

99
struct SiteURLCell: View {

Modules/Menu/Sources/Sections/Information/ReleasesRouteCell.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
// Copyright © 2024 Cocoatype, LLC. All rights reserved.
33

44
import SwiftUI
5-
import TestHelpersInterface
65

76
import FactoryKit
87

98
import BarcDefaults
109
import BarcReleases
10+
import BarcTestHelpersInterface
1111

1212
struct ReleasesRouteCell: View {
1313
@Injected(\.defaultsProvider) private var defaultsProvider

Modules/Menu/Tests/Components/SiteURLCellTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
// Copyright © 2025 Cocoatype, LLC. All rights reserved.
33

44
import SwiftUI
5-
import TestHelpersInterface
65
import Testing
76
import ViewInspector
87

98
import BarcReleases
9+
import BarcTestHelpersInterface
1010

1111
@testable import BarcMenu
1212

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Created by Geoff Pado on 1/20/25.
22
// Copyright © 2025 Cocoatype, LLC. All rights reserved.
33

4-
import TestHelpersInterface
54
import ViewInspector
65

6+
import BarcTestHelpersInterface
7+
78
extension Inspection: @retroactive InspectionEmissary, @unchecked Sendable {}

Modules/Onboarding/Tests/Components/PageControlTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
// Copyright © 2025 Cocoatype, LLC. All rights reserved.
33

44
import SwiftUI
5-
import TestHelpers
65
import Testing
76
import ViewInspector
87

8+
import BarcTestHelpers
9+
910
@testable import BarcOnboarding
1011

1112
@MainActor

0 commit comments

Comments
 (0)