Skip to content

Commit

Permalink
Merge branch 'main' into api_connection_unit_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wzieba committed Oct 20, 2023
2 parents a1b9bd8 + 22a8241 commit bae3ca3
Showing 1 changed file with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner

@RunWith(RobolectricTestRunner::class)
internal class EventsBuilderTest {

class EventsBuilderTest {
private lateinit var sut: EventsBuilder

@Before
Expand All @@ -22,15 +21,10 @@ internal class EventsBuilderTest {
applicationContext,
TEST_SITE_ID,
)
Settings.Secure.putString(
applicationContext.contentResolver,
Settings.Secure.ANDROID_ID,
"android_id"
)
}

@Test
fun `events builder prepares correct pageview pixel`() {
fun `when building pageview event, then build the correct one`() {
// when
val event: Map<String, Any> = sut.buildEvent(
TEST_URL,
Expand All @@ -49,7 +43,7 @@ internal class EventsBuilderTest {
}

@Test
fun `events builder prepares correct heartbeat pixel`() {
fun `when building heartbeat event, then build the correct one`() {
// when
val event: Map<String, Any> = sut.buildEvent(
TEST_URL,
Expand All @@ -68,7 +62,7 @@ internal class EventsBuilderTest {
}

@Test
fun `events builder prepares correct videostart pixel`() {
fun `when building videostart event, then build the correct one`() {
// when
val event: Map<String, Any> = sut.buildEvent(
TEST_URL,
Expand All @@ -87,7 +81,7 @@ internal class EventsBuilderTest {
}

@Test
fun `events builder prepares correct vheartbeat pixel`() {
fun `when building vheartbeat event, then build the correct one`() {
// when
val event: Map<String, Any> = sut.buildEvent(
TEST_URL,
Expand Down Expand Up @@ -171,8 +165,9 @@ internal class EventsBuilderTest {
@Test
fun `given metadata is not null, when creating a pixel, include metadata`() {
// given
val metadata =
ParselyMetadata(ArrayList<String>(), "link", "section", null, null, null, null)
val metadata = ParselyMetadata(
ArrayList<String>(), "link", "section", null, null, null, null
)

// when
val event: Map<String, Any> = sut.buildEvent(
Expand Down Expand Up @@ -207,7 +202,6 @@ internal class EventsBuilderTest {
.containsEntry("parsely_site_uuid", null)
}


companion object {
const val TEST_SITE_ID = "Example"
const val TEST_URL = "http://example.com/some-old/article.html"
Expand Down

0 comments on commit bae3ca3

Please sign in to comment.