Skip to content

Commit

Permalink
Setting up first test
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanfallet committed Jan 14, 2024
1 parent 1e8ef56 commit feb5f26
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [ GroupeMINASTE, NathanFallet, PlugNPush, JohnPoliakov ]
21 changes: 21 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up our JDK environment
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 19
- name: Install dependencies and run tests
run: ./gradlew test koverXmlReport
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
13 changes: 7 additions & 6 deletions shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,19 @@ kotlin {
api("me.nathanfallet.extopy:extopy-commons:0.1.0")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val commonTest by getting
val androidMain by getting {
dependencies {
implementation("io.ktor:ktor-client-android:$ktorVersion")
implementation("com.squareup.sqldelight:android-driver:$sqlDelightVersion")
}
}
val androidUnitTest by getting
val androidUnitTest by getting {
dependencies {
implementation(kotlin("test"))
implementation("io.mockk:mockk:1.13.8")
}
}
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package me.nathanfallet.extopy.usecases.auth

import io.mockk.every
import io.mockk.mockk
import me.nathanfallet.extopy.repositories.application.ITokenRepository
import kotlin.test.Test
import kotlin.test.assertEquals

class GetTokenUseCaseTest {

@Test
fun invoke() {
val tokenRepository = mockk<ITokenRepository>()
val useCase = GetTokenUseCase(tokenRepository)
every { tokenRepository.getToken() }.returns("token")
assertEquals("token", useCase())
}

}

0 comments on commit feb5f26

Please sign in to comment.