Skip to content

Commit

Permalink
test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
bsneed committed Nov 2, 2023
1 parent 9d2af8a commit 90be8e3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ jobs:

build_and_test_ios:
needs: cancel_previous
runs-on: macos-latest
runs-on: macos-13
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
xcode-version: '15.0.1'
- uses: actions/checkout@v2
- run: xcodebuild -scheme SegmentConsentOneTrust test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13'
- run: xcodebuild clean -scheme SegmentConsentOneTrust test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 15' CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO"

build_and_test_tvos:
needs: cancel_previous
runs-on: macos-latest
runs-on: macos-13
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
xcode-version: '15.0.1'
- uses: actions/checkout@v2
- run: xcodebuild -scheme SegmentConsentOneTrust test -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV'
- run: xcodebuild clean -scheme SegmentConsentOneTrust test -sdk iphonesimulator -destination 'platform=tvOS Simulator,name=Apple TV' CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO"


24 changes: 13 additions & 11 deletions Sources/SegmentConsentOneTrust-Tests/SegmentConsentPrefTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@ final class SegmentConsentPrefTests: XCTestCase {

waitUntilStarted(analytics: analytics)

// reject all categories in OneTrust
OTPublishersHeadlessSDK.shared.saveConsent(type: .preferenceCenterRejectAll)

RunLoop.main.run(until: Date.distantPast)
// C0001 is always true
OTPublishersHeadlessSDK.shared.updatePurposeConsent(forGroup: "C0002", consentValue: false)
OTPublishersHeadlessSDK.shared.updatePurposeConsent(forGroup: "C0003", consentValue: false)
OTPublishersHeadlessSDK.shared.updatePurposeConsent(forGroup: "C0004", consentValue: false)
OTPublishersHeadlessSDK.shared.saveConsent(type: .preferenceCenterConfirm)
RunLoop.main.run(until: Date(timeIntervalSinceNow: 2.0))

analytics.track(name: "stamp event")

Expand Down Expand Up @@ -152,11 +154,14 @@ final class SegmentConsentPrefTests: XCTestCase {
waitUntilStarted(analytics: analytics)

// reject all categories in OneTrust
OTPublishersHeadlessSDK.shared.updatePurposeConsent(forGroup: "C0001", consentValue: true)
// C0001 is always true
OTPublishersHeadlessSDK.shared.updatePurposeConsent(forGroup: "C0002", consentValue: true)
OTPublishersHeadlessSDK.shared.updatePurposeConsent(forGroup: "C0002", consentValue: false)
OTPublishersHeadlessSDK.shared.updatePurposeConsent(forGroup: "C0003", consentValue: false)
OTPublishersHeadlessSDK.shared.updatePurposeConsent(forGroup: "C0004", consentValue: false)
OTPublishersHeadlessSDK.shared.saveConsent(type: .preferenceCenterConfirm)

RunLoop.main.run(until: Date.distantPast)

RunLoop.main.run(until: Date(timeIntervalSinceNow: 2.0))

analytics.track(name: "stamp event")

RunLoop.main.run(until: Date.distantPast)
Expand Down Expand Up @@ -222,14 +227,11 @@ final class SegmentConsentPrefTests: XCTestCase {

waitUntilStarted(analytics: analytics)

// reject all categories in OneTrust
// C0001 is always true
OTPublishersHeadlessSDK.shared.updatePurposeConsent(forGroup: "C0002", consentValue: true)
OTPublishersHeadlessSDK.shared.updatePurposeConsent(forGroup: "C0003", consentValue: false)
OTPublishersHeadlessSDK.shared.updatePurposeConsent(forGroup: "C0004", consentValue: false)

OTPublishersHeadlessSDK.shared.saveConsent(type: .preferenceCenterConfirm)

RunLoop.main.run(until: Date(timeIntervalSinceNow: 2.0))

XCTAssertEqual(OTPublishersHeadlessSDK.shared.getConsentStatus(forCategory: "C0002"), 1)
Expand Down

0 comments on commit 90be8e3

Please sign in to comment.