Skip to content

Commit

Permalink
Restored WkdClientTest with a few changes.| #1201
Browse files Browse the repository at this point in the history
  • Loading branch information
DenBond7 committed Aug 13, 2021
1 parent 81a102c commit 7976139
Showing 1 changed file with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* © 2016-present FlowCrypt a.s. Limitations apply. Contact [email protected]
* Contributors:
* Ivan Pizhenko
* DenBond7
*/

package com.flowcrypt.email.api.email

import com.flowcrypt.email.api.wkd.WkdClient
import kotlinx.coroutines.runBlocking
import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.RuntimeEnvironment

@RunWith(RobolectricTestRunner::class)
class WkdClientTest {
@Test
fun existingEmailTest() = runBlocking {
val keys =
WkdClient.lookupEmail(RuntimeEnvironment.getApplication(), "[email protected]")
assertTrue("Key not found", keys != null)
assertTrue("There are no keys in the key collection", keys!!.keyRings.hasNext())
}

@Test
fun nonExistingEmailTest1() = runBlocking {
val keys = WkdClient.lookupEmail(
RuntimeEnvironment.getApplication(),
"[email protected]"
)
assertTrue("Key found for non-existing email", keys == null)
}

@Test
fun nonExistingEmailTest2() = runBlocking {
val keys = WkdClient.lookupEmail(RuntimeEnvironment.getApplication(), "[email protected]")
assertTrue("Key found for non-existing email", keys == null)
}

@Test
fun nonExistingDomainTest() = runBlocking {
val keys = WkdClient.lookupEmail(
RuntimeEnvironment.getApplication(),
"[email protected]"
)
assertTrue("Key found for non-existing email", keys == null)
}
}

0 comments on commit 7976139

Please sign in to comment.