Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
damian-kaczmarek committed Oct 23, 2024
1 parent e12cf66 commit f61e6c9
Showing 1 changed file with 72 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import com.wire.kalium.logic.data.id.QualifiedID
import kotlin.test.Test
import kotlin.test.assertFalse
import kotlin.test.assertTrue


class QualifiedIdTest {
@Test
fun givenIdsWithoutDomains_whenEqualsIgnoringBlankDomain_thenReturnsTrue() {
// Given
val qualifiedId1 = QualifiedID("id1", "")
val qualifiedId2 = QualifiedID("id1", "")

// When
val result = qualifiedId1.equalsIgnoringBlankDomain(qualifiedId2)

// Then
assertTrue(result)
}

@Test
fun givenOneIdWithoutDomain_whenEqualsIgnoringBlankDomain_thenReturnsTrue() {
// Given
val qualifiedId1 = QualifiedID("id1", "")
val qualifiedId2 = QualifiedID("id1", "domain")

// When
val result = qualifiedId1.equalsIgnoringBlankDomain(qualifiedId2)

// Then
assertTrue(result)
}

@Test
fun givenIdsWithSameDomains_whenEqualsIgnoringBlankDomain_thenReturnsTrue() {
// Given
val qualifiedId1 = QualifiedID("id1", "domain")
val qualifiedId2 = QualifiedID("id1", "domain")

// When
val result = qualifiedId1.equalsIgnoringBlankDomain(qualifiedId2)

// Then
assertTrue(result)
}

@Test
fun givenIdsWithDifferentDomains_whenEqualsIgnoringBlankDomain_thenReturnsFalse() {
// Given
val qualifiedId1 = QualifiedID("id1", "domain1")
val qualifiedId2 = QualifiedID("id1", "domain2")

// When
val result = qualifiedId1.equalsIgnoringBlankDomain(qualifiedId2)

// Then
assertTrue(!result)
}

@Test
fun givenIdsWithDifferentValues_whenEqualsIgnoringBlankDomain_thenReturnsFalse() {
// Given
val qualifiedId1 = QualifiedID("id1", "")
val qualifiedId2 = QualifiedID("id2", "")

// When
val result = qualifiedId1.equalsIgnoringBlankDomain(qualifiedId2)

// Then
assertFalse(result)
}
}

0 comments on commit f61e6c9

Please sign in to comment.