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

Extract building logic to EventsBuilder. Add unit tests for it. #79

Merged
merged 18 commits into from
Oct 20, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
tests: add test for null metadata case
wzieba committed Oct 18, 2023
commit 2ea953e84f8ccc242d7ae2fb2109f82661e919e9
Original file line number Diff line number Diff line change
@@ -149,6 +149,26 @@ internal class EventsBuilderTest {
.containsAllEntriesOf(extraData)
}

@Test
fun `given metadata is null, when creating a pixel, don't include metadata`() {
// given
val metadata: ParselyMetadata? = null

// when
val event: Map<String, Any> = sut.buildEvent(
TEST_URL,
"",
"pageview",
metadata,
null,
TEST_UUID,
)

// then
assertThat(event).doesNotContainKey("metadata")
}


private fun MapAssert<String, Any>.sharedPixelAssertions() =
hasSize(6)
.containsEntry("url", TEST_URL)