Skip to content

Commit 41425af

Browse files
committed
add identify event sanity check
1 parent d1b1f43 commit 41425af

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

libs/common/tests/event_serialization_test.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,21 @@ TEST(EventSerialization, DebugEvent) {
5353
ASSERT_EQ(result, event);
5454
}
5555

56+
TEST(EventSerialization, IdentifyEvent) {
57+
auto creation_date = std::chrono::system_clock::from_time_t({});
58+
AttributeReference::SetType attrs;
59+
ContextFilter filter(false, attrs);
60+
auto e = events::client::IdentifyEvent{
61+
creation_date,
62+
filter.filter(ContextBuilder().kind("foo", "bar").build())};
63+
64+
auto event = boost::json::value_from(e);
65+
66+
auto result = boost::json::parse(
67+
"{\"kind\":\"identify\",\"creationDate\":0,\"context\":{\"key\":"
68+
"\"bar\",\"kind\":\"foo\"}}");
69+
70+
ASSERT_EQ(result, event);
71+
}
72+
5673
} // namespace launchdarkly::events

0 commit comments

Comments
 (0)