-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e12cf66
commit f61e6c9
Showing
1 changed file
with
72 additions
and
0 deletions.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
logic/src/commonTest/kotlin/com/wire/kalium/logic/data/id/QualifiedIdTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |