Skip to content

ViewModel tests are refencing incorrect repositories #123

@cdsap

Description

@cdsap

ViewModel tests are generating incorrect references to the repositories. Example:

package com.awesomeapp.analytics

import org.junit.Test
import org.junit.Before
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
import org.junit.Rule
import kotlinx.coroutines.test.runTest
import kotlinx.coroutines.ExperimentalCoroutinesApi
import org.junit.Assert.*
import kotlin.test.assertTrue
import kotlin.test.assertNotNull
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import com.awesomeapp.analytics.*


@OptIn(ExperimentalCoroutinesApi::class)
class Viewmodel23_1Test {
        private lateinit var repository0: Repository12_5

    private lateinit var viewModel: Viewmodel23_1

    @Before
    fun setup() {
       repository0 = Repository12_5(com.awesomeapp.profile.Api8_6(), com.awesomeapp.identity.Api4_6())
        viewModel = Viewmodel23_1(
            repository0
        )
    }

    @Test
    fun `test state updates with data`() = runTest {
        assertNotNull(viewModel.state.value)
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions