Skip to content

Commit

Permalink
fix: use device model and type
Browse files Browse the repository at this point in the history
- Changed the device `name` to `type` as described in the specifications
- Removed the device `version`
- Added resolution to the device `type` as described in the speficiations
  • Loading branch information
jboix committed Nov 7, 2024
1 parent 447e4df commit 4bb5955
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ private class DataDeserializer : JsonDeserializer<Any?>() {
node.set<ObjectNode>(
"device",
ObjectNode(ctxt.nodeFactory).apply {
put("name", userAgent.getValueOrNull(UserAgent.DEVICE_NAME))
put("version", userAgent.getValueOrNull(UserAgent.DEVICE_VERSION))
put("model", userAgent.getValueOrNull(UserAgent.DEVICE_NAME))
put("type", userAgent.getValueOrNull(UserAgent.DEVICE_CLASS))
},
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class EventRequestTest(
browserNode["version"] shouldBe "129"

val deviceNode = dataNode["device"] as Map<*, *>
deviceNode["name"] shouldBe "Apple Macintosh"
deviceNode["model"] shouldBe "Apple Macintosh"
deviceNode["type"] shouldBe "Desktop"

val osNode = dataNode["os"] as Map<*, *>
osNode["name"] shouldBe "Mac OS"
Expand Down Expand Up @@ -75,7 +76,8 @@ class EventRequestTest(
browserNode["version"] shouldBe "0.1"

val deviceNode = dataNode["device"] as Map<*, *>
deviceNode["name"] shouldBe "Apple BOT"
deviceNode["model"] shouldBe "Apple BOT"
deviceNode["type"] shouldBe "Robot"

val osNode = dataNode["os"] as Map<*, *>
osNode["name"] shouldBe "Cloud"
Expand Down

0 comments on commit 4bb5955

Please sign in to comment.