-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
preview.mp4 용량 초과로 롤백
- Loading branch information
Showing
42 changed files
with
302 additions
and
129 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
80 changes: 80 additions & 0 deletions
80
core/data-base/src/androidTest/java/com/linky/core/data_base/LinkDaoTest.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,80 @@ | ||
package com.linky.core.data_base | ||
|
||
import android.content.Context | ||
import androidx.paging.PagingConfig | ||
import androidx.paging.PagingSource | ||
import androidx.paging.testing.TestPager | ||
import androidx.test.core.app.ApplicationProvider | ||
import com.linky.core.data_base.link.dao.LinkDao | ||
import com.linky.core.data_base.link.entity.LinkEntity | ||
import com.linky.model.open_graph.OpenGraphData | ||
import com.squareup.moshi.Moshi | ||
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.runBlocking | ||
import kotlinx.coroutines.withContext | ||
import org.junit.jupiter.api.AfterEach | ||
import org.junit.jupiter.api.Assertions | ||
import org.junit.jupiter.api.BeforeEach | ||
import org.junit.jupiter.api.Test | ||
|
||
class LinkDaoTest { | ||
|
||
private lateinit var database: LinkyDataBase | ||
private lateinit var linkDao: LinkDao | ||
private val moshi = Moshi.Builder().addLast(KotlinJsonAdapterFactory()).build() | ||
|
||
@BeforeEach | ||
fun setup() { | ||
val context = ApplicationProvider.getApplicationContext<Context>() | ||
database = LinkyDataBase.build(context, moshi) | ||
linkDao = database.getLinkDao() | ||
} | ||
|
||
@AfterEach | ||
fun closeDb() { | ||
database.close() | ||
} | ||
|
||
@Test | ||
fun test_LinkDao_insertLink(): Unit = runBlocking { | ||
val link = LinkEntity( | ||
id = null, | ||
memo = "test_memo", | ||
openGraphData = OpenGraphData( | ||
title = "Site_Title", | ||
description = "Site_Desc", | ||
url = "https://example.com", | ||
image = "https://example.com/asdasdasd.jpg", | ||
siteName = "Site_Name", | ||
type = "website", | ||
), | ||
readCount = 0, | ||
createAt = System.currentTimeMillis(), | ||
isRemove = false | ||
) | ||
val id = withContext(Dispatchers.IO) { | ||
linkDao.insert(link) | ||
} | ||
|
||
Assertions.assertTrue(id > 0L) | ||
} | ||
|
||
@Test | ||
fun test_LinkDao_selectPage(): Unit = runBlocking { | ||
val pager = TestPager( | ||
config = PagingConfig( | ||
pageSize = 20, | ||
enablePlaceholders = false | ||
), | ||
pagingSource = linkDao.selectPage(), | ||
) | ||
|
||
val result = pager.refresh() as PagingSource.LoadResult.Page | ||
val loadedData = result.data | ||
|
||
println("loadedData.size: ${loadedData.size}") | ||
|
||
Assertions.assertTrue(loadedData.isNotEmpty()) | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.linky.data_base"> | ||
package="com.linky.core.data_base"> | ||
|
||
</manifest> |
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
4 changes: 2 additions & 2 deletions
4
...a_base/backup/LinkTagCrossRefBackupDao.kt → ...a_base/backup/LinkTagCrossRefBackupDao.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
2 changes: 1 addition & 1 deletion
2
...ta_base/backup/entity/LinkBackupEntity.kt → ...ta_base/backup/entity/LinkBackupEntity.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
2 changes: 1 addition & 1 deletion
2
...a_base/converter/LongTypeListConverter.kt → ...a_base/converter/LongTypeListConverter.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
2 changes: 1 addition & 1 deletion
2
..._base/converter/OpenGraphDataConverter.kt → ..._base/converter/OpenGraphDataConverter.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
6 changes: 3 additions & 3 deletions
6
...a/com/linky/data_base/link/dao/LinkDao.kt → .../linky/core/data_base/link/dao/LinkDao.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
4 changes: 2 additions & 2 deletions
4
.../data_base/link/dao/LinkTagCrossRefDao.kt → .../data_base/link/dao/LinkTagCrossRefDao.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
8 changes: 4 additions & 4 deletions
8
...a_base/link/data_source/LinkDataSource.kt → ...a_base/link/data_source/LinkDataSource.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
20 changes: 10 additions & 10 deletions
20
...se/link/data_source/LinkDataSourceImpl.kt → ...se/link/data_source/LinkDataSourceImpl.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
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
8 changes: 4 additions & 4 deletions
8
...ava/com/linky/data_base/tag/dao/TagDao.kt → ...om/linky/core/data_base/tag/dao/TagDao.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
8 changes: 4 additions & 4 deletions
8
...ata_base/tag/data_source/TagDataSource.kt → ...ata_base/tag/data_source/TagDataSource.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
Oops, something went wrong.