Skip to content

Commit

Permalink
more tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaysubra committed Aug 19, 2024
1 parent 7af6d8a commit e89fd6a
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@
"data" : {
"attributes" : {
"anonymous_id" : "anon-id",
"properties" : null
"properties" : {

}
},
"type" : "profile"
}
},
"properties" : null,
"properties" : {

},
"time" : "2009-02-13T23:31:30Z",
"unique_id" : "00000000-0000-0000-0000-000000000001"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
"anonymous_id" : "foo",
"email" : "foo",
"phone_number" : "foo",
"properties" : null
"properties" : {

}
},
"type" : "profile"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
},
"organization" : "Blobco",
"phone_number" : "+15555555555",
"properties" : null,
"properties" : {

},
"title" : "Jelly"
},
"type" : "profile"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
"anonymous_id" : "foo",
"email" : "foo",
"phone_number" : "foo",
"properties" : null
"properties" : {

}
},
"type" : "profile"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"anonymous_id" : "foo",
"email" : "foo",
"phone_number" : "foo",
"properties" : null
"properties" : {

}
},
"type" : "profile"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
- some: "Blobco"
▿ phoneNumber: Optional<String>
- some: "+15555555555"
▿ properties: nil
- value: (0 elements)
▿ properties: [:]
- value: 0 key/value pairs
▿ title: Optional<String>
- some: "Jelly"
- type: "profile"
Expand Down
4 changes: 2 additions & 2 deletions Tests/KlaviyoSwiftTests/EncodableTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class EncodableTests: XCTestCase {
enablement: "AUTHORIZED",
background: "AVAILABLE",
profile: ProfilePayload(email: "foo", phoneNumber: "foo", anonymousId: "foo"))
let request = KlaviyoRequest(apiKey: "foo", endpoint: .registerPushToken(tokenPayload), uuid: environment.uuid().uuidString)
let request = KlaviyoRequest(apiKey: "foo", endpoint: .registerPushToken(tokenPayload), uuid: KlaviyoEnvironment.test().uuid().uuidString)
let klaviyoState = KlaviyoState(
email: "foo",
anonymousId: "foo",
Expand All @@ -30,7 +30,7 @@ final class EncodableTests: XCTestCase {
pushToken: "foo",
pushEnablement: .authorized,
pushBackground: .available,
deviceData: .init(context: environment.appContextInfo())),
deviceData: .init(context: KlaviyoEnvironment.test().appContextInfo())),
queue: [request],
requestsInFlight: [request])
assertSnapshot(matching: klaviyoState, as: .json(KlaviyoEnvironment.encoder))
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"anonymousId":"foo","email":"foo","pushTokenData":{"pushBackground":"AVAILABLE","pushToken":"foo","pushEnablement":"AUTHORIZED","deviceData":{"os_version":"17.0.0","app_version":"15.0","environment":"debug","klaviyo_sdk":"swift","device_model":"arm64","app_id":"com.apple.dt.xctest.tool","app_build":"22189","sdk_version":"3.2.0","device_id":"278E698D-7E37-477E-BD83-60BB4FCF404E","os_name":"iOS","manufacturer":"Apple","app_name":"xctest"}},"phoneNumber":"foo","queue":[{"apiKey":"foo","uuid":"294B9706-602D-4E5A-B34E-27A08F88AC14","endpoint":{"registerPushToken":{"_0":{"data":{"attributes":{"background":"AVAILABLE","device_metadata":{"app_name":"xctest","app_id":"com.apple.dt.xctest.tool","environment":"debug","device_model":"arm64","os_name":"iOS","device_id":"278E698D-7E37-477E-BD83-60BB4FCF404E","sdk_version":"3.2.0","os_version":"17.0.0","manufacturer":"Apple","app_version":"15.0","app_build":"22189","klaviyo_sdk":"swift"},"platform":"ios","vendor":"APNs","profile":{"data":{"attributes":{"email":"foo","phone_number":"foo","anonymous_id":"foo","properties":null},"type":"profile"}},"token":"foo","enablement_status":"AUTHORIZED"},"type":"push-token"}}}}}]}
{"phoneNumber":"foo","queue":[{"apiKey":"foo","uuid":"00000000-0000-0000-0000-000000000001","endpoint":{"registerPushToken":{"_0":{"data":{"type":"push-token","attributes":{"token":"foo","enablement_status":"AUTHORIZED","platform":"ios","background":"AVAILABLE","profile":{"data":{"attributes":{"anonymous_id":"foo","phone_number":"foo","email":"foo","properties":{}},"type":"profile"}},"device_metadata":{"klaviyo_sdk":"swift","os_version":"17.0.0","device_id":"278E698D-7E37-477E-BD83-60BB4FCF404E","app_id":"com.apple.dt.xctest.tool","os_name":"iOS","manufacturer":"Apple","app_build":"22189","sdk_version":"3.2.0","environment":"debug","app_name":"xctest","app_version":"15.0","device_model":"arm64"},"vendor":"APNs"}}}}}}],"email":"foo","anonymousId":"foo","pushTokenData":{"pushBackground":"AVAILABLE","deviceData":{"device_id":"fe-fi-fo-fum","manufacturer":"Orange","os_version":"1.1.1","app_name":"FooApp","app_version":"1.2.3","app_build":"1","device_model":"jPhone 1,1","app_id":"com.klaviyo.fooapp","environment":"debug","sdk_version":"3.2.0","klaviyo_sdk":"swift","os_name":"iOS"},"pushToken":"foo","pushEnablement":"AUTHORIZED"}}

0 comments on commit e89fd6a

Please sign in to comment.