Skip to content

Commit

Permalink
Merge branch 'master' into ab/CHNL-6170/remove-opened-push-event-from…
Browse files Browse the repository at this point in the history
…-public-api
  • Loading branch information
ab1470 authored Sep 4, 2024
2 parents 41fbf80 + bf0effc commit 6f4068c
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
exclude: Tests/KlaviyoSwiftTests/__Snapshots__
exclude: Tests/.*/__Snapshots__
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
Expand Down
5 changes: 3 additions & 2 deletions Tests/KlaviyoCoreTests/EncodableTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ final class EncodableTests: XCTestCase {
assertSnapshot(matching: payload, as: .json(KlaviyoEnvironment.encoder))
}

func testEventPayloadWithoutMetadata() throws {
let createEventPayload = CreateEventPayload(data: CreateEventPayload.Event(name: "test", anonymousId: "anon-id"))
func testEventPayload() throws {
let payloadData = CreateEventPayload.Event(name: "test", properties: SAMPLE_PROPERTIES, anonymousId: "anon-id")
let createEventPayload = CreateEventPayload(data: payloadData)
assertSnapshot(matching: createEventPayload, as: .json(KlaviyoEnvironment.encoder))
}

Expand Down
2 changes: 0 additions & 2 deletions Tests/KlaviyoCoreTests/KlaviyoAPITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import XCTest
@MainActor
final class KlaviyoAPITests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.

environment = KlaviyoEnvironment.test()
}

Expand Down
8 changes: 8 additions & 0 deletions Tests/KlaviyoCoreTests/TestUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ let TEST_FAILURE_JSON_INVALID_EMAIL = """
}
"""

let SAMPLE_PROPERTIES = [
"blob": "blob",
"stuff": 2,
"hello": [
"sub": "dict"
]
] as [String: Any]

extension ArchiverClient {
static let test = ArchiverClient(
archivedData: { _, _ in ARCHIVED_RETURNED_DATA },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,27 @@
}
},
"properties" : {

"App Build" : "1",
"App ID" : "com.klaviyo.fooapp",
"App Name" : "FooApp",
"App Version" : "1.2.3",
"blob" : "blob",
"Device ID" : "fe-fi-fo-fum",
"Device Manufacturer" : "Orange",
"Device Model" : "jPhone 1,1",
"hello" : {
"sub" : "dict"
},
"OS Name" : "iOS",
"OS Version" : "1.1.1",
"Push Token" : "",
"SDK Name" : "swift",
"SDK Version" : "3.2.0",
"stuff" : 2
},
"time" : "2009-02-13T23:31:30Z",
"unique_id" : "00000000-0000-0000-0000-000000000001"
},
"type" : "event"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@
}
},
"uuid" : "00000000-0000-0000-0000-000000000001"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
},
"type" : "profile"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@
},
"type" : "push-token"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
},
"type" : "push-token-unregister"
}
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
internalRequestError(KlaviyoCore.KlaviyoAPIError.internalError("Invalid url string. API URL: "))
internalRequestError(KlaviyoCore.KlaviyoAPIError.internalError("Invalid url string. API URL: "))

0 comments on commit 6f4068c

Please sign in to comment.