-
Notifications
You must be signed in to change notification settings - Fork 0
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
e72bda0
commit 65f4c4e
Showing
9 changed files
with
98 additions
and
12 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
37 changes: 37 additions & 0 deletions
37
pubnub-chat-impl/src/jvmTest/kotlin/com/pubnub/integration/ChannelJvmIntegrationTest.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,37 @@ | ||
package com.pubnub.integration | ||
|
||
import com.pubnub.chat.types.GetFilesResult | ||
import com.pubnub.chat.types.InputFile | ||
import com.pubnub.test.await | ||
import kotlinx.coroutines.test.runTest | ||
import org.junit.Test | ||
import java.io.ByteArrayInputStream | ||
import kotlin.test.assertEquals | ||
import kotlin.test.assertNotNull | ||
|
||
class ChannelJvmIntegrationTest : BaseChatIntegrationTest() { | ||
@Test | ||
fun sendFileGetFileDeleteFile() = runTest { | ||
val fileName = "test.txt" | ||
val type = "text/plain" | ||
val data = "dfa" | ||
val source = ByteArrayInputStream(data.toByteArray()) | ||
val file = InputFile(name = fileName, type = type, source = source) | ||
|
||
// send file | ||
channel01.sendText(text = "messageWithFile", files = listOf(file)).await() | ||
|
||
// get file | ||
val filesResult: GetFilesResult = channel01.getFiles().await() | ||
|
||
assertEquals(1, filesResult.files.size) | ||
val actualFile = filesResult.files.first() | ||
assertEquals(fileName, actualFile.name) | ||
assertNotNull(actualFile.id) | ||
assertNotNull(actualFile.url) | ||
|
||
// delete file | ||
val deleteFileResult = channel01.deleteFile(actualFile.id, actualFile.name).await() | ||
assertEquals(200, deleteFileResult.status) | ||
} | ||
} |
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