Skip to content

Commit

Permalink
Revert "Remove tests"
Browse files Browse the repository at this point in the history
This reverts commit 8855d1b.
  • Loading branch information
waliid committed Nov 27, 2024
1 parent 296e4d5 commit 4bf55b3
Show file tree
Hide file tree
Showing 206 changed files with 17,777 additions and 13 deletions.
72 changes: 72 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/Pillarbox.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,78 @@
region = "CH"
codeCoverageEnabled = "YES">
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES"
testExecutionOrdering = "random">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AnalyticsTests"
BuildableName = "AnalyticsTests"
BlueprintName = "AnalyticsTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES"
testExecutionOrdering = "random">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CircumspectTests"
BuildableName = "CircumspectTests"
BlueprintName = "CircumspectTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES"
testExecutionOrdering = "random">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CoreTests"
BuildableName = "CoreTests"
BlueprintName = "CoreTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES"
testExecutionOrdering = "random">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CoreBusinessTests"
BuildableName = "CoreBusinessTests"
BlueprintName = "CoreBusinessTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES"
testExecutionOrdering = "random">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "MonitoringTests"
BuildableName = "MonitoringTests"
BlueprintName = "MonitoringTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES"
testExecutionOrdering = "random">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "PlayerTests"
BuildableName = "PlayerTests"
BlueprintName = "PlayerTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
18 changes: 9 additions & 9 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"pins" : [
{
"identity" : "commanders-act-apple",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SRGSSR/commanders-act-apple.git",
"state" : {
"revision" : "e06657ceae07237a08e04ca2d34c2ec7612483b8",
"version" : "5.4.12"
}
},
{
"identity" : "comscore-swift-package-manager",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -36,15 +45,6 @@
"version" : "1.0.1"
}
},
{
"identity" : "iosv5",
"kind" : "remoteSourceControl",
"location" : "https://github.com/CommandersAct/iOSV5.git",
"state" : {
"revision" : "24ffbad1da8467b615958be9d0dd1e92c4396699",
"version" : "5.4.12"
}
},
{
"identity" : "nimble",
"kind" : "remoteSourceControl",
Expand Down
36 changes: 36 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,42 @@ let package = Package(
.target(name: "PackageInfo")
]
),
.testTarget(
name: "AnalyticsTests",
dependencies: [
.target(name: "PillarboxAnalytics"),
.target(name: "PillarboxCircumspect"),
.target(name: "PillarboxStreams")
]
),
.testTarget(
name: "CircumspectTests",
dependencies: [
.target(name: "PillarboxCircumspect")
]
),
.testTarget(
name: "CoreTests",
dependencies: [
.target(name: "PillarboxCircumspect"),
.target(name: "PillarboxCore")
]
),
.testTarget(
name: "CoreBusinessTests",
dependencies: [
.target(name: "PillarboxCircumspect"),
.target(name: "PillarboxCoreBusiness")
]
),
.testTarget(
name: "MonitoringTests",
dependencies: [
.target(name: "PillarboxCircumspect"),
.target(name: "PillarboxMonitoring"),
.target(name: "PillarboxStreams")
]
),
.testTarget(
name: "PlayerTests",
dependencies: [
Expand Down
52 changes: 52 additions & 0 deletions Tests/AnalyticsTests/ComScore/ComScoreHitExpectation.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//
// Copyright (c) SRG SSR. All rights reserved.
//
// License information is available from the LICENSE file.
//

import PillarboxAnalytics

/// Describes a comScore stream hit expectation.
struct ComScoreHitExpectation {
private let name: ComScoreHit.Name
private let evaluate: (ComScoreLabels) -> Void

fileprivate init(name: ComScoreHit.Name, evaluate: @escaping (ComScoreLabels) -> Void) {
self.name = name
self.evaluate = evaluate
}

static func match(hit: ComScoreHit, with expectation: Self) -> Bool {
guard hit.name == expectation.name else { return false }
expectation.evaluate(hit.labels)
return true
}
}

extension ComScoreHitExpectation: CustomDebugStringConvertible {
var debugDescription: String {
name.rawValue
}
}

extension ComScoreTestCase {
func play(evaluate: @escaping (ComScoreLabels) -> Void = { _ in }) -> ComScoreHitExpectation {
ComScoreHitExpectation(name: .play, evaluate: evaluate)
}

func playrt(evaluate: @escaping (ComScoreLabels) -> Void = { _ in }) -> ComScoreHitExpectation {
ComScoreHitExpectation(name: .playrt, evaluate: evaluate)
}

func pause(evaluate: @escaping (ComScoreLabels) -> Void = { _ in }) -> ComScoreHitExpectation {
ComScoreHitExpectation(name: .pause, evaluate: evaluate)
}

func end(evaluate: @escaping (ComScoreLabels) -> Void = { _ in }) -> ComScoreHitExpectation {
ComScoreHitExpectation(name: .end, evaluate: evaluate)
}

func view(evaluate: @escaping (ComScoreLabels) -> Void = { _ in }) -> ComScoreHitExpectation {
ComScoreHitExpectation(name: .view, evaluate: evaluate)
}
}
Loading

0 comments on commit 4bf55b3

Please sign in to comment.