Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowing opened push event to be transmitted when SDK is not initialized #181

Merged
merged 5 commits into from
May 31, 2024

using case where instead of conditionals

4e1dc18
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Merged

Allowing opened push event to be transmitted when SDK is not initialized #181

using case where instead of conditionals
4e1dc18
Select commit
Loading
Failed to load commit list.
GitHub Actions / Xcode test results succeeded May 30, 2024 in 0s

Xcode test results

Testing workspace klaviyo-swift-sdk with scheme klaviyo-swift-sdk-Package

Summary

TotalSuccess PassedFailure FailedSkipped SkippedExpected Failure Expected Failure⏱️ Time
1261260001.64s

Test Summary

KlaviyoSwiftTests

  • Device: iPhone 14, 17.2 (21C62)
  • SDK: Simulator - iOS 16.4, 16.4
TestTotalSuccessFailureSkippedExpected Failure
test-class APIRequestErrorHandlingTests1515000
test-class AppLifeCycleEventsTests1111000
test-class ArchivalSystemTest11000
test-class ArchivalUtilsTests88000
test-class EncodableTests77000
test-class FileUtilsTests22000
test-class KlaviyoAPITests77000
test-class KlaviyoSDKTests1111000
test-class KlaviyoStateTests88000
test-class NetworkSessionTests33000
test-class StateChangePublisherTests33000
test-class StateManagementEdgeCaseTests2828000
test-class StateManagementTests2222000

Failure Failures

All tests passed 🎉


Code Coverage

Coverage Covered Executable
KlaviyoSwift 65.16 % 2401 3685
  Store.swift 59.63 % 192 322
  Misc.swift 34.93 % 51 146
  Cancellation.swift 86.18 % 212 246
  NetworkSession.swift 61.33 % 46 75
  ConcurrencySupport.swift 3.03 % 4 132
  APIRequestErrorHandling.swift 97.09 % 100 103
  KlaviyoModels.swift 100.00 % 70 70
  ArchivalUtils.swift 100.00 % 42 42
  StateManagement.swift 93.22 % 440 472
  AppContextInfo.swift 53.25 % 41 77
  KlaviyoEnvironment.swift 41.76 % 38 91
  ReachabilitySwift.swift 18.94 % 43 227
  Publisher.swift 46.15 % 66 143
  Klaviyo.swift 86.78 % 105 121
  AppLifeCycleEvents.swift 100.00 % 76 76
  InternalAPIModels.swift 97.56 % 160 164
  Effect.swift 39.86 % 116 291
  StateChangePublisher.swift 43.18 % 19 44
  Create.swift 90.21 % 129 143
  KlaviyoState.swift 78.23 % 327 418
  KlaviyoAPI.swift 93.58 % 102 109
  FileUtils.swift 95.65 % 22 23
  LoggerClient.swift 0.00 % 0 1
  SDKRequestIterator.swift 0.00 % 0 149
KlaviyoSwiftExtension 0.00 % 0 0
KlaviyoSwiftTests 74.18 % 5794 7811
  APIRequestErrorHandlingTests.swift 100.00 % 402 402
  SDKRequestIterator.swift 0.00 % 0 149
  Cancellation.swift 86.18 % 212 246
  KlaviyoModels.swift 100.00 % 70 70
  AppContextInfo.swift 53.25 % 41 77
  KlaviyoTestUtils.swift 84.40 % 92 109
  StateChangePublisher.swift 43.18 % 19 44
  FileUtils.swift 95.65 % 22 23
  StateManagement.swift 93.22 % 440 472
  StateChangePublisherTests.swift 99.18 % 242 244
  ArchivalUtilsTests.swift 100.00 % 128 128
  Publisher.swift 46.15 % 66 143
  AppLifeCycleEvents.swift 100.00 % 76 76
  KlaviyoAPITests.swift 96.83 % 214 221
  InternalAPIModels.swift 97.56 % 160 164
  KlaviyoState.swift 78.23 % 327 418
  Effect.swift 39.86 % 116 291
  StateManagementTests.swift 99.86 % 711 712
  TestData.swift 100.00 % 50 50
  LoggerClient.swift 0.00 % 0 1
  ConcurrencySupport.swift 3.03 % 4 132
  KlaviyoAPI.swift 93.58 % 102 109
  Create.swift 90.21 % 129 143
  TestStore.swift 36.41 % 387 1063
  ArchivalUtils.swift 100.00 % 42 42
  ReachabilitySwift.swift 18.94 % 43 227
  StateManagementEdgeCaseTests.swift 100.00 % 445 445
  SimpleMockURLProtocol.swift 100.00 % 12 12
  Store.swift 59.63 % 192 322
  NetworkSessionTests.swift 100.00 % 22 22
  AppLifeCycleEventsTests.swift 96.03 % 242 252
  FileUtilsTests.swift 84.78 % 39 46
  EncodableTests.swift 100.00 % 68 68
  KlaviyoEnvironment.swift 41.76 % 38 91
  KlaviyoStateTests.swift 95.05 % 192 202
  NetworkSession.swift 61.33 % 46 75
  KlaviyoSDKTests.swift 98.00 % 147 150
  Misc.swift 34.93 % 51 146
  APIRequestErrorHandling.swift 97.09 % 100 103
  Klaviyo.swift 86.78 % 105 121
Total 71.29 % 8195 11496

Details

Test Details

KlaviyoSwiftTestsback

APIRequestErrorHandlingTests back

SuccessFailureSkippedExpected Failure⏱️
15 (100%)0 (0%)0 (0%)0 (0%)0.01s
Successtest-method testMissingOrInvalidResponse()
Successtest-method testRateLimitErrorWithExistingBackoffRetry()
Successtest-method testRateLimitErrorWithExistingRetry()
Successtest-method testRetryWithRetryAfter()
Successtest-method testSendRequestDataDecodingError()
Successtest-method testSendRequestFailureIncrementsRetryCount()
Successtest-method testSendRequestFailureWithBackoff()
Successtest-method testSendRequestHttpFailureDequesRequest()
Successtest-method testSendRequestHttpFailureForEmailResetsStateAndDequesRequest()
Successtest-method testSendRequestHttpFailureForPhoneNumberResetsStateAndDequesRequest()
Successtest-method testSendRequestInternalError()
Successtest-method testSendRequestInternalRequestError()
Successtest-method testSendRequestInvalidData()
Successtest-method testSendRequestMaxRetries()
Successtest-method testSendRequestUnknownError()

AppLifeCycleEventsTests back

SuccessFailureSkippedExpected Failure⏱️
11 (100%)0 (0%)0 (0%)0 (0%)0.00s
Successtest-method testAppBackgroundGetsStopAction()
Successtest-method testAppBackgroundStopsReachability()
Successtest-method testAppBecomeActiveGetsStartAction()
Successtest-method testAppBecomesActiveStartsReachibility()
Successtest-method testAppTerminateGetsStopAction()
Successtest-method testAppTerminateStopsReachability()
Successtest-method testReachabilityNotificationStatusHandled()
Successtest-method testReachabilityStartFailureIsHandled()
Successtest-method testReachabilityStatusNilThenNotNil()
Successtest-method testReachaibilityNotificationGetsRightAction()
Successtest-method testStartReachabilityCalledOnSubscription()

ArchivalSystemTest back

SuccessFailureSkippedExpected Failure⏱️
1 (100%)0 (0%)0 (0%)0 (0%)0.00s
Successtest-method testArchiveUnarchive()

ArchivalUtilsTests back

SuccessFailureSkippedExpected Failure⏱️
8 (100%)0 (0%)0 (0%)0 (0%)0.00s
Successtest-method testArchiveFails()
Successtest-method testArchiveUnarchive()
Successtest-method testArchiveWriteFails()
Successtest-method testUnarchive()
Successtest-method testUnarchiveInvalidData()
Successtest-method testUnarchiveUnableToRemoveFile()
Successtest-method testUnarchiveUnarchiveFails()
Successtest-method testUnarchiveWhereFileDoesNotExist()

EncodableTests back

SuccessFailureSkippedExpected Failure⏱️
7 (100%)0 (0%)0 (0%)0 (0%)0.30s
Successtest-method testEventPayloadWithMetadata()
Successtest-method testEventPayloadWithoutMetadata()
Successtest-method testKlaviyoRequest()
Successtest-method testKlaviyoState()
Successtest-method testProfilePayload()
Successtest-method testTokenPayload()
Successtest-method testUnregisterTokenPayload()

FileUtilsTests back

SuccessFailureSkippedExpected Failure⏱️
2 (100%)0 (0%)0 (0%)0 (0%)0.00s
Successtest-method testFilePathForData()
Successtest-method testRemoveItemWithError()

KlaviyoAPITests back

SuccessFailureSkippedExpected Failure⏱️
7 (100%)0 (0%)0 (0%)0 (0%)0.00s
Successtest-method testEncodingError()
Successtest-method testInvalidStatusCode()
Successtest-method testInvalidURL()
Successtest-method testNetworkError()
Successtest-method testSuccessfulResponseWithEvent()
Successtest-method testSuccessfulResponseWithProfile()
Successtest-method testSuccessfulResponseWithStoreToken()

KlaviyoSDKTests back

SuccessFailureSkippedExpected Failure⏱️
11 (100%)0 (0%)0 (0%)0 (0%)1.01s
Successtest-method testCreateEvent()
Successtest-method testCreateEventFromDocumentation()
Successtest-method testHandlePushNotification()
Successtest-method testInitializeSDk()
Successtest-method testKlaviyoSDKInit()
Successtest-method testPropertyGetters()
Successtest-method testSetExternalId()
Successtest-method testSetFirstName()
Successtest-method testSetProfile()
Successtest-method testSetPushToken()
Successtest-method testUnhandlePushNotification()

KlaviyoStateTests back

SuccessFailureSkippedExpected Failure⏱️
8 (100%)0 (0%)0 (0%)0 (0%)0.00s
Successtest-method testBackgroundStates()
Successtest-method testFullKlaviyoStateEncodingDecodingIsEqual()
Successtest-method testLoadNewKlaviyoState()
Successtest-method testPushEnablementStates()
Successtest-method testSaveKlaviyoStateWithMissingApiKeyLogsError()
Successtest-method testStateFileExistsInvalidData()
Successtest-method testStateFileExistsInvalidJSON()
Successtest-method testValidStateFileExists()

NetworkSessionTests back

SuccessFailureSkippedExpected Failure⏱️
3 (100%)0 (0%)0 (0%)0 (0%)0.31s
Successtest-method testCreateEmphemeralSesionHeaders()
Successtest-method testDefaultUserAgent()
Successtest-method testSessionDataTask()

StateChangePublisherTests back

SuccessFailureSkippedExpected Failure⏱️
3 (100%)0 (0%)0 (0%)0 (0%)0.00s
Successtest-method testQuickStateUpdatesTriggerOnlyOneSaves()
Successtest-method testStateChangeDuplicateAreRemoved()
Successtest-method testStateChangePublisher()

StateManagementEdgeCaseTests back

SuccessFailureSkippedExpected Failure⏱️
28 (100%)0 (0%)0 (0%)0 (0%)0.00s
Successtest-method testCompleteInitializationWhileAlreadyInitialized()
Successtest-method testCompleteInitializationWithExistingIdentifiers()
Successtest-method testEnqueueNonOpenedPushEventUninitializedDoesNotAddToPendingRequest()
Successtest-method testInitializeAfterInitialized()
Successtest-method testInitializeWhileInitializing()
Successtest-method testNetworkStatusChangedUninitialized()
Successtest-method testOpenedPushEventUninitializedAddsToPendingRequests()
Successtest-method testSendRequestBeforeInitialization()
Successtest-method testSetEmailMissingAnonymousIdStillSetsEmail()
Successtest-method testSetEmailUninitializedDoesNotAddToPendingRequest()
Successtest-method testSetEmailWithWhiteSpace()
Successtest-method testSetEmptyEmail()
Successtest-method testSetEmptyExternalId()
Successtest-method testSetEmptyPhoneNumber()
Successtest-method testSetExternalIdMissingAnonymousIdStillSetsExternalId()
Successtest-method testSetExternalIdUninitializedDoesNotAddToPendingRequest()
Successtest-method testSetExternalIdWithWhiteSpaces()
Successtest-method testSetPhoneNumberMissingApiKeyStillSetsPhoneNumber()
Successtest-method testSetPhoneNumberUninitializedDoesNotAddToPendingRequest()
Successtest-method testSetPhoneNumberWithWhiteSpaces()
Successtest-method testSetProfileUnitialized()
Successtest-method testSetProfileWithEmptyStringIdentifiers()
Successtest-method testSetPushTokenUninitializedDoesNotAddToPendingRequest()
Successtest-method testSetPushTokenWithMissingAnonymousId()
Successtest-method testStartUninitialized()
Successtest-method testStopInitializing()
Successtest-method testStopUninitialized()
Successtest-method testTokenRequestMissingApiKey()

StateManagementTests back

SuccessFailureSkippedExpected Failure⏱️
22 (100%)0 (0%)0 (0%)0 (0%)0.00s
Successtest-method testEmptyQueueDoesNotFlush()
Successtest-method testEnqueueEventWhenInitilizingSendsEvent()
Successtest-method testEnqueueEvent()
Successtest-method testFlushQueueDuringExponentialBackoff()
Successtest-method testFlushQueueExponentialBackoffGoesToSize()
Successtest-method testFlushQueueWithMultipleRequests()
Successtest-method testFlushUninitializedQueueDoesNotFlush()
Successtest-method testFlushWithPendingProfile()
Successtest-method testInitializeSubscribesToAppropriatePublishers()
Successtest-method testInitialize()
Successtest-method testNetworkConnectivityChanges()
Successtest-method testQueueThatIsFlushingDoesNotFlush()
Successtest-method testSendRequestWhenNotFlushing()
Successtest-method testSendRequestWithNoRequestsInFlight()
Successtest-method testSetEmail()
Successtest-method testSetExternalId()
Successtest-method testSetPhoneNumber()
Successtest-method testSetProfileWithAllProfileIdentifiersAndProperties()
Successtest-method testSetProfileWithExistingProperties()
Successtest-method testSetPushTokenMultipleTimes()
Successtest-method testSetPushToken()
Successtest-method testStopWithRequestsInFlight()