Skip to content

Commit

Permalink
fix: Update unit test for apiV3
Browse files Browse the repository at this point in the history
  • Loading branch information
sirambd committed Oct 24, 2023
1 parent e5ca0b5 commit 397ba0d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class ApiRepositoryTest : KDriveTest() {
@DisplayName("Retrieve shared remote file")
fun mySharedFileTest() {
val order = File.SortType.BIGGER
assertApiResponseData(getMySharedFiles(okHttpClient, userDrive.driveId, order, 1))
assertApiResponseData(getMySharedFiles(okHttpClient, userDrive.driveId, order, null))
}

@Nested
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,25 @@ class FileControllerTest : KDriveTest() {

private fun getAndSaveRemoteRootFiles(): Pair<File, ArrayList<File>>? {
// Get and save remote root files in realm db test
return getFilesFromCacheOrDownload(Utils.ROOT_ID, 1, true, userDrive = userDrive, customRealm = realm).also {
return getFilesFromCacheOrDownload(
Utils.ROOT_ID,
loadNextPage = false,
ignoreCache = true,
userDrive = userDrive,
customRealm = realm
).also {
assertNotNull(it, "remote root files cannot be null")
}
}

private fun getLocalRootFiles() =
getFilesFromCacheOrDownload(Utils.ROOT_ID, 1, false, userDrive = userDrive, customRealm = realm)
getFilesFromCacheOrDownload(
Utils.ROOT_ID,
loadNextPage = false,
ignoreCache = false,
userDrive = userDrive,
customRealm = realm
)

private fun createAndStoreOfficeFile(transaction: ((remoteFile: File) -> Unit)? = null): File {
val remoteFile = createFileForTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ object ApiRepository : ApiRepositoryCore() {
}

private fun pagination(page: Int, perPage: Int = PER_PAGE) = "page=$page&per_page=$perPage"

private fun loadCursor(cursor: String?, perPage: Int = PER_PAGE): String {
return "limit=$perPage${if (cursor == null) "" else "&cursor=$cursor"}"
}
Expand Down

0 comments on commit 397ba0d

Please sign in to comment.