Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge current work on tests with updates #104

Merged
merged 8 commits into from
May 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
Changelog
=========

## Version 5.4.6

_2022-05-11_

* Update dependencies to stable version.
* Fix some tests.
* Fix Gradle scripts.

## Version 5.4.5

_2022-04-09_

* Update dependencies to stable version.

## Version 5.4.4

_2022-03-26_
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ Then add the following dependencies in your app `build.gradle` or `build.gradle.

**Groovy**
```groovy
debugImplementation "com.infinum.dbinspector:dbinspector:5.4.4"
releaseImplementation "com.infinum.dbinspector:dbinspector-no-op:5.4.4"
debugImplementation "com.infinum.dbinspector:dbinspector:5.4.6"
releaseImplementation "com.infinum.dbinspector:dbinspector-no-op:5.4.6"
```
**KotlinDSL**
```kotlin
debugImplementation("com.infinum.dbinspector:dbinspector:5.4.4")
releaseImplementation("com.infinum.dbinspector:dbinspector-no-op:5.4.4")
debugImplementation("com.infinum.dbinspector:dbinspector:5.4.6")
releaseImplementation("com.infinum.dbinspector:dbinspector-no-op:5.4.6")
```

### Usage
Expand Down
4 changes: 2 additions & 2 deletions config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ext {
]
releaseConfig = [
"group" : "com.infinum.dbinspector",
"version" : "5.4.4",
"versionCode": 5 * 100 * 100 + 4 * 100 + 4
"version" : "5.4.6",
"versionCode": 5 * 100 * 100 + 4 * 100 + 6
]
}
4 changes: 3 additions & 1 deletion dbinspector-no-op/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ android {
}
}

namespace releaseConfig.group
resourcePrefix "dbinspector_"

compileOptions {
Expand All @@ -37,7 +38,8 @@ android {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
freeCompilerArgs += [
'-Xexplicit-api=strict'
'-Xexplicit-api=strict',
'-Xjvm-default=all'
]
}

Expand Down
3 changes: 1 addition & 2 deletions dbinspector-no-op/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.infinum.dbinspector">
xmlns:tools="http://schemas.android.com/tools">

<application>

Expand Down
12 changes: 7 additions & 5 deletions dbinspector/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ android {
}
}

namespace releaseConfig.group
resourcePrefix "dbinspector_"

lintOptions {
lint {
disable 'RtlEnabled', 'VectorPath', 'IconLocation'
}

Expand All @@ -44,8 +45,9 @@ android {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
freeCompilerArgs += [
'-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi',
'-Xexplicit-api=strict'
'-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi',
'-Xexplicit-api=strict',
'-Xjvm-default=all'
]
}

Expand Down Expand Up @@ -122,11 +124,11 @@ protobuf {
}

kover {
enabled = true
disabled = false
coverageEngine.set(kotlinx.kover.api.CoverageEngine.INTELLIJ)
intellijEngineVersion.set(libs.versions.intellij.get())
jacocoEngineVersion.set(libs.versions.jacoco.get())
generateReportOnCheck.set(true)
generateReportOnCheck = true
}

tasks.withType(Test) {
Expand Down
3 changes: 1 addition & 2 deletions dbinspector/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.infinum.dbinspector">
xmlns:tools="http://schemas.android.com/tools">

<application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@ internal class HistoryDataStoreTest : BaseTest() {

@Test
fun `Data source exposes datastore`() {
launch {
blockingTest {
val store: DataStore<HistoryEntity> = get()
val source = HistoryDataStore(store)

runBlockingTest {
val actual = source.store()
assertEquals(store, actual)
}
val actual = source.store()

assertEquals(store, actual)
}
}

Expand All @@ -51,11 +50,9 @@ internal class HistoryDataStoreTest : BaseTest() {
coEvery { firstOrNull() } returns null
}

launch {
runBlockingTest {
val actual = source.current()
assertEquals(expected, actual)
}
blockingTest {
val actual = source.current()
assertEquals(expected, actual)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ internal class HistorySerializerTest : BaseTest() {
mockkStatic(HistoryEntity::class)
every { HistoryEntity.parseFrom(mockk<InputStream>()) } returns mockk()

launch {
test {
serializer.readFrom(any())
}

Expand All @@ -56,7 +56,7 @@ internal class HistorySerializerTest : BaseTest() {
val serializer = HistorySerializer()
val stream: OutputStream = mockk()

launch {
test {
serializer.writeTo(given, stream)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@ internal class SettingsDataStoreTest : BaseTest() {

@Test
fun `Data source exposes datastore`() {
launch {
blockingTest {
val store: DataStore<SettingsEntity> = get()
val source = SettingsDataStore(store)

runBlockingTest {
val actual = source.store()
assertEquals(store, actual)
}
val actual = source.store()
assertEquals(store, actual)
}
}

Expand All @@ -51,11 +49,9 @@ internal class SettingsDataStoreTest : BaseTest() {
coEvery { firstOrNull() } returns null
}

launch {
runBlockingTest {
val actual = source.current()
assertEquals(expected, actual)
}
blockingTest {
val actual = source.current()
assertEquals(expected, actual)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ internal class SettingsSerializerTest : BaseTest() {
mockkStatic(SettingsEntity::class)
every { SettingsEntity.parseFrom(mockk<InputStream>()) } returns mockk()

launch {
test {
serializer.readFrom(any())
}

Expand All @@ -56,7 +56,7 @@ internal class SettingsSerializerTest : BaseTest() {
val serializer = SettingsSerializer()
val stream: OutputStream = mockk()

launch {
test {
serializer.writeTo(given, stream)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ internal class AndroidConnectionSourceTest : BaseTest() {

val source = AndroidConnectionSource()

launch {
test {
source.openConnection(given)
}

Expand All @@ -69,7 +69,7 @@ internal class AndroidConnectionSourceTest : BaseTest() {

source.connectionPool[given] = expected

launch {
test {
source.openConnection(given)
}

Expand Down Expand Up @@ -102,7 +102,7 @@ internal class AndroidConnectionSourceTest : BaseTest() {

source.connectionPool[given] = expected

launch {
test {
source.closeConnection(given)
}

Expand All @@ -126,7 +126,7 @@ internal class AndroidConnectionSourceTest : BaseTest() {

val source = AndroidConnectionSource()

launch {
test {
source.closeConnection(given)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ internal class ConnectionRepositoryTest : BaseTest() {
coEvery { control.mapper.invoke(any()) } returns mockk()
coEvery { control.converter.invoke(any()) } returns ""

launch {
test {
repository.open(any())
}

Expand All @@ -61,7 +61,7 @@ internal class ConnectionRepositoryTest : BaseTest() {
coEvery { control.mapper.invoke(any()) } returns mockk()
coEvery { control.converter.invoke(any()) } returns ""

launch {
test {
repository.close(any())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@ internal class ConnectionConverterTest : BaseTest() {

@Test
fun `Default converts to data model with same value`() =
launch {
test {
val given = mockk<ConnectionParameters> {
every { databasePath } returns "test.db"
}
val expected = "test.db"

val converter = ConnectionConverter()

val actual = test {
converter(given)
}
val actual = converter(given)

assertEquals(expected, actual)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ internal class ConnectionMapperTest : BaseTest() {

@Test
fun `Default local values maps to default domain values`() =
launch {
test {
val given: SQLiteDatabase = mockk()
val expected = DatabaseConnection(database = given)

val mapper = ConnectionMapper()
val actual = test {
mapper(given)
}

val actual = mapper(given)

assertEquals(expected, actual)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ internal class CloseConnectionInteractorTest : BaseTest() {

coEvery { source.closeConnection(any()) } returns mockk()

launch {
test {
interactor.invoke(any())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ internal class OpenConnectionInteractorTest : BaseTest() {

coEvery { source.openConnection(any()) } returns mockk()

launch {
test {
interactor.invoke(any())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ internal class CloseConnectionUseCaseTest : BaseTest() {

coEvery { repository.close(any()) } returns Unit

launch {
test {
useCase.invoke(any())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ internal class OpenConnectionUseCaseTest : BaseTest() {

coEvery { repository.open(any()) } returns mockk()

launch {
test {
useCase.invoke(any())
}

Expand Down
Loading