Skip to content

Commit

Permalink
fixing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leogdion committed May 6, 2024
1 parent 819baa1 commit 087a3b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Sources/AviaryInsights/Event.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
//

public struct Event {
public static let pageview = "pageview"
public let name: String
public let domain: String?
public let url: String
Expand All @@ -36,8 +37,8 @@ public struct Event {
public let revenue: Revenue?

public init(
name: String,
url: String,
name: String = Self.pageview,
domain: String? = nil,
referrer: String? = nil,
props: [String: (any Sendable)?]? = nil,
Expand Down
4 changes: 2 additions & 2 deletions Tests/AviaryInsightsTests/AviaryInsightsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ final class AviaryInsightsTests: XCTestCase {
func randomProps() -> [String: (any Sendable)?] {
var values = [String: (any Sendable)?]()
let keyCount: Int = .random(in: 3 ... 7)
for index in 0 ..< keyCount {
for _ in 0 ..< keyCount {
let value: any Sendable
let type: Bool = .random()
switch type {
Expand All @@ -98,9 +98,9 @@ final class AviaryInsightsTests: XCTestCase {
let count: Int = .random(in: 10 ... 20)
return (0 ..< count).map { _ in
Event(
url: UUID().uuidString,
name: UUID().uuidString,
domain: Bool.random() ? UUID().uuidString : nil,
url: UUID().uuidString,
referrer: Bool.random() ? UUID().uuidString : nil,
props: Bool.random() ? randomProps() : nil,
revenue: Bool.random() ? .random() : nil
Expand Down

0 comments on commit 087a3b5

Please sign in to comment.