From 90be8e3022614eaa943d05689504be540659d686 Mon Sep 17 00:00:00 2001 From: Brandon Sneed Date: Thu, 2 Nov 2023 12:13:19 -0700 Subject: [PATCH] test updates --- .github/workflows/swift.yml | 12 +++++----- .../SegmentConsentPrefTests.swift | 24 ++++++++++--------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 6f45097..03a6def 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -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" \ No newline at end of file diff --git a/Sources/SegmentConsentOneTrust-Tests/SegmentConsentPrefTests.swift b/Sources/SegmentConsentOneTrust-Tests/SegmentConsentPrefTests.swift index 6fafbd6..d1e888d 100644 --- a/Sources/SegmentConsentOneTrust-Tests/SegmentConsentPrefTests.swift +++ b/Sources/SegmentConsentOneTrust-Tests/SegmentConsentPrefTests.swift @@ -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") @@ -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) @@ -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)