Skip to content

Commit

Permalink
Revert "Move util to test_utils"
Browse files Browse the repository at this point in the history
This reverts commit f94a8aa.
  • Loading branch information
matt-ramotar committed Nov 18, 2024
1 parent c6f7d6c commit 6d9c058
Show file tree
Hide file tree
Showing 35 changed files with 84 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.advanceUntilIdle
import kotlinx.coroutines.test.runTest
import org.mobilenativefoundation.store.core5.ExperimentalStoreApi
import org.mobilenativefoundation.store.store5.test_utils.InMemoryPersister
import org.mobilenativefoundation.store.store5.test_utils.asSourceOfTruth
import org.mobilenativefoundation.store.store5.test_utils.getData
import org.mobilenativefoundation.store.store5.util.InMemoryPersister
import org.mobilenativefoundation.store.store5.util.asSourceOfTruth
import org.mobilenativefoundation.store.store5.util.getData
import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertEquals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import org.mobilenativefoundation.store.store5.StoreReadResponse.Data
import org.mobilenativefoundation.store.store5.test_utils.InMemoryPersister
import org.mobilenativefoundation.store.store5.test_utils.asSourceOfTruth
import org.mobilenativefoundation.store.store5.test_utils.getData
import org.mobilenativefoundation.store.store5.util.InMemoryPersister
import org.mobilenativefoundation.store.store5.util.asSourceOfTruth
import org.mobilenativefoundation.store.store5.util.getData
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import kotlinx.coroutines.flow.take
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import org.mobilenativefoundation.store.store5.test_utils.fake.fallback.HardcodedPages
import org.mobilenativefoundation.store.store5.test_utils.fake.fallback.Page
import org.mobilenativefoundation.store.store5.test_utils.fake.fallback.PagesDatabase
import org.mobilenativefoundation.store.store5.test_utils.fake.fallback.PrimaryPagesApi
import org.mobilenativefoundation.store.store5.test_utils.fake.fallback.SecondaryPagesApi
import org.mobilenativefoundation.store.store5.util.fake.fallback.HardcodedPages
import org.mobilenativefoundation.store.store5.util.fake.fallback.Page
import org.mobilenativefoundation.store.store5.util.fake.fallback.PagesDatabase
import org.mobilenativefoundation.store.store5.util.fake.fallback.PrimaryPagesApi
import org.mobilenativefoundation.store.store5.util.fake.fallback.SecondaryPagesApi
import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertEquals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import org.mobilenativefoundation.store.store5.test_utils.assertEmitsExactly
import org.mobilenativefoundation.store.store5.util.assertEmitsExactly
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ import kotlinx.coroutines.test.runTest
import org.mobilenativefoundation.store.store5.StoreReadResponse.Data
import org.mobilenativefoundation.store.store5.StoreReadResponse.Loading
import org.mobilenativefoundation.store.store5.impl.extensions.fresh
import org.mobilenativefoundation.store.store5.test_utils.FakeFetcher
import org.mobilenativefoundation.store.store5.test_utils.FakeFlowingFetcher
import org.mobilenativefoundation.store.store5.test_utils.InMemoryPersister
import org.mobilenativefoundation.store.store5.test_utils.asFlowable
import org.mobilenativefoundation.store.store5.test_utils.asSourceOfTruth
import org.mobilenativefoundation.store.store5.test_utils.assertEmitsExactly
import org.mobilenativefoundation.store.store5.util.FakeFetcher
import org.mobilenativefoundation.store.store5.util.FakeFlowingFetcher
import org.mobilenativefoundation.store.store5.util.InMemoryPersister
import org.mobilenativefoundation.store.store5.util.asFlowable
import org.mobilenativefoundation.store.store5.util.asSourceOfTruth
import org.mobilenativefoundation.store.store5.util.assertEmitsExactly
import kotlin.test.Test
import kotlin.test.assertContains
import kotlin.test.assertEquals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import org.mobilenativefoundation.store.store5.test_utils.assertEmitsExactly
import org.mobilenativefoundation.store.store5.util.assertEmitsExactly
import kotlin.test.Test
import kotlin.test.assertEquals

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.advanceUntilIdle
import kotlinx.coroutines.test.runTest
import org.mobilenativefoundation.store.store5.test_utils.KeyTracker
import org.mobilenativefoundation.store.store5.util.KeyTracker
import kotlin.test.Test
import kotlin.test.assertEquals

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import kotlinx.coroutines.flow.first
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import org.mobilenativefoundation.store.store5.impl.extensions.get
import org.mobilenativefoundation.store.store5.test_utils.InMemoryPersister
import org.mobilenativefoundation.store.store5.test_utils.asSourceOfTruth
import org.mobilenativefoundation.store.store5.util.InMemoryPersister
import org.mobilenativefoundation.store.store5.util.asSourceOfTruth
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import org.mobilenativefoundation.store.store5.impl.operators.mapIndexed
import org.mobilenativefoundation.store.store5.test_utils.assertEmitsExactly
import org.mobilenativefoundation.store.store5.util.assertEmitsExactly
import kotlin.test.Test

@OptIn(ExperimentalCoroutinesApi::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import org.mobilenativefoundation.store.store5.SourceOfTruth.ReadException
import org.mobilenativefoundation.store.store5.SourceOfTruth.WriteException
import org.mobilenativefoundation.store.store5.test_utils.FakeFetcher
import org.mobilenativefoundation.store.store5.test_utils.InMemoryPersister
import org.mobilenativefoundation.store.store5.test_utils.asSourceOfTruth
import org.mobilenativefoundation.store.store5.test_utils.assertEmitsExactly
import org.mobilenativefoundation.store.store5.util.FakeFetcher
import org.mobilenativefoundation.store.store5.util.InMemoryPersister
import org.mobilenativefoundation.store.store5.util.asSourceOfTruth
import org.mobilenativefoundation.store.store5.util.assertEmitsExactly
import kotlin.test.Test

@OptIn(ExperimentalCoroutinesApi::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import org.mobilenativefoundation.store.store5.SourceOfTruth.ReadException
import org.mobilenativefoundation.store.store5.SourceOfTruth.WriteException
import org.mobilenativefoundation.store.store5.impl.PersistentSourceOfTruth
import org.mobilenativefoundation.store.store5.impl.SourceOfTruthWithBarrier
import org.mobilenativefoundation.store.store5.test_utils.InMemoryPersister
import org.mobilenativefoundation.store.store5.test_utils.assertEmitsExactly
import org.mobilenativefoundation.store.store5.util.InMemoryPersister
import org.mobilenativefoundation.store.store5.util.assertEmitsExactly
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import kotlinx.coroutines.flow.take
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import org.mobilenativefoundation.store.store5.test_utils.FakeFetcher
import org.mobilenativefoundation.store.store5.test_utils.assertEmitsExactly
import org.mobilenativefoundation.store.store5.util.FakeFetcher
import org.mobilenativefoundation.store.store5.util.assertEmitsExactly
import kotlin.test.Test
import kotlin.test.assertEquals

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import org.mobilenativefoundation.store.core5.ExperimentalStoreApi
import org.mobilenativefoundation.store.store5.impl.extensions.inHours
import org.mobilenativefoundation.store.store5.test_utils.assertEmitsExactly
import org.mobilenativefoundation.store.store5.test_utils.fake.Notes
import org.mobilenativefoundation.store.store5.test_utils.fake.NotesApi
import org.mobilenativefoundation.store.store5.test_utils.fake.NotesBookkeeping
import org.mobilenativefoundation.store.store5.test_utils.fake.NotesConverterProvider
import org.mobilenativefoundation.store.store5.test_utils.fake.NotesDatabase
import org.mobilenativefoundation.store.store5.test_utils.fake.NotesKey
import org.mobilenativefoundation.store.store5.test_utils.fake.NotesUpdaterProvider
import org.mobilenativefoundation.store.store5.test_utils.fake.NotesValidator
import org.mobilenativefoundation.store.store5.test_utils.model.InputNote
import org.mobilenativefoundation.store.store5.test_utils.model.NetworkNote
import org.mobilenativefoundation.store.store5.test_utils.model.NoteData
import org.mobilenativefoundation.store.store5.test_utils.model.NotesWriteResponse
import org.mobilenativefoundation.store.store5.test_utils.model.OutputNote
import org.mobilenativefoundation.store.store5.util.assertEmitsExactly
import org.mobilenativefoundation.store.store5.util.fake.Notes
import org.mobilenativefoundation.store.store5.util.fake.NotesApi
import org.mobilenativefoundation.store.store5.util.fake.NotesBookkeeping
import org.mobilenativefoundation.store.store5.util.fake.NotesConverterProvider
import org.mobilenativefoundation.store.store5.util.fake.NotesDatabase
import org.mobilenativefoundation.store.store5.util.fake.NotesKey
import org.mobilenativefoundation.store.store5.util.fake.NotesUpdaterProvider
import org.mobilenativefoundation.store.store5.util.fake.NotesValidator
import org.mobilenativefoundation.store.store5.util.model.InputNote
import org.mobilenativefoundation.store.store5.util.model.NetworkNote
import org.mobilenativefoundation.store.store5.util.model.NoteData
import org.mobilenativefoundation.store.store5.util.model.NotesWriteResponse
import org.mobilenativefoundation.store.store5.util.model.OutputNote
import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertEquals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import org.mobilenativefoundation.store.store5.test_utils.assertEmitsExactly
import org.mobilenativefoundation.store.store5.util.assertEmitsExactly
import kotlin.test.Test

@ExperimentalCoroutinesApi
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.mobilenativefoundation.store.store5.test_utils
package org.mobilenativefoundation.store.store5.util

import kotlinx.coroutines.NonCancellable
import kotlinx.coroutines.channels.BufferOverflow
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.mobilenativefoundation.store.store5.test_utils
package org.mobilenativefoundation.store.store5.util

import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.take
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mobilenativefoundation.store.store5.test_utils
package org.mobilenativefoundation.store.store5.util

import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.mobilenativefoundation.store.store5.test_utils
package org.mobilenativefoundation.store.store5.util

import org.mobilenativefoundation.store.store5.SourceOfTruth

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.mobilenativefoundation.store.store5.test_utils
package org.mobilenativefoundation.store.store5.util

internal interface TestApi<Key : Any, Network : Any, Output : Any, Response : Any> {
fun get(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.mobilenativefoundation.store.store5.test_utils
package org.mobilenativefoundation.store.store5.util

import kotlinx.coroutines.flow.filterNot
import kotlinx.coroutines.flow.first
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.mobilenativefoundation.store.store5.test_utils.fake
package org.mobilenativefoundation.store.store5.util.fake

import org.mobilenativefoundation.store.store5.test_utils.model.NoteData
import org.mobilenativefoundation.store.store5.util.model.NoteData

internal object NoteCollections {
object Keys {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.mobilenativefoundation.store.store5.test_utils.fake
package org.mobilenativefoundation.store.store5.util.fake

import org.mobilenativefoundation.store.store5.test_utils.model.Note
import org.mobilenativefoundation.store.store5.util.model.Note

internal object Notes {
val One = Note("1", "Title-1", "Content-1")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.mobilenativefoundation.store.store5.test_utils.fake
package org.mobilenativefoundation.store.store5.util.fake

import org.mobilenativefoundation.store.store5.test_utils.TestApi
import org.mobilenativefoundation.store.store5.test_utils.model.InputNote
import org.mobilenativefoundation.store.store5.test_utils.model.NetworkNote
import org.mobilenativefoundation.store.store5.test_utils.model.NoteData
import org.mobilenativefoundation.store.store5.test_utils.model.NotesWriteResponse
import org.mobilenativefoundation.store.store5.util.TestApi
import org.mobilenativefoundation.store.store5.util.model.InputNote
import org.mobilenativefoundation.store.store5.util.model.NetworkNote
import org.mobilenativefoundation.store.store5.util.model.NoteData
import org.mobilenativefoundation.store.store5.util.model.NotesWriteResponse

internal class NotesApi : TestApi<NotesKey, NetworkNote, InputNote, NotesWriteResponse> {
internal val db = mutableMapOf<NotesKey, NetworkNote>()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.mobilenativefoundation.store.store5.test_utils.fake
package org.mobilenativefoundation.store.store5.util.fake

class NotesBookkeeping {
private val log: MutableMap<NotesKey, Long?> = mutableMapOf()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.mobilenativefoundation.store.store5.test_utils.fake
package org.mobilenativefoundation.store.store5.util.fake

import org.mobilenativefoundation.store.store5.Converter
import org.mobilenativefoundation.store.store5.impl.extensions.inHours
import org.mobilenativefoundation.store.store5.test_utils.model.InputNote
import org.mobilenativefoundation.store.store5.test_utils.model.NetworkNote
import org.mobilenativefoundation.store.store5.test_utils.model.OutputNote
import org.mobilenativefoundation.store.store5.util.model.InputNote
import org.mobilenativefoundation.store.store5.util.model.NetworkNote
import org.mobilenativefoundation.store.store5.util.model.OutputNote

internal class NotesConverterProvider {
fun provide(): Converter<NetworkNote, InputNote, OutputNote> =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.mobilenativefoundation.store.store5.test_utils.fake
package org.mobilenativefoundation.store.store5.util.fake

import org.mobilenativefoundation.store.store5.test_utils.model.InputNote
import org.mobilenativefoundation.store.store5.test_utils.model.OutputNote
import org.mobilenativefoundation.store.store5.util.model.InputNote
import org.mobilenativefoundation.store.store5.util.model.OutputNote

internal class NotesDatabase {
private val db: MutableMap<NotesKey, OutputNote?> = mutableMapOf()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.mobilenativefoundation.store.store5.test_utils.fake
package org.mobilenativefoundation.store.store5.util.fake

sealed class NotesKey {
data class Single(val id: String) : NotesKey()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.mobilenativefoundation.store.store5.test_utils.fake
package org.mobilenativefoundation.store.store5.util.fake

import org.mobilenativefoundation.store.store5.Updater
import org.mobilenativefoundation.store.store5.UpdaterResult
import org.mobilenativefoundation.store.store5.test_utils.model.InputNote
import org.mobilenativefoundation.store.store5.test_utils.model.NotesWriteResponse
import org.mobilenativefoundation.store.store5.test_utils.model.OutputNote
import org.mobilenativefoundation.store.store5.util.model.InputNote
import org.mobilenativefoundation.store.store5.util.model.NotesWriteResponse
import org.mobilenativefoundation.store.store5.util.model.OutputNote

internal class NotesUpdaterProvider(private val api: NotesApi) {
fun provide(): Updater<NotesKey, OutputNote, NotesWriteResponse> =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.mobilenativefoundation.store.store5.test_utils.fake
package org.mobilenativefoundation.store.store5.util.fake

import org.mobilenativefoundation.store.store5.Validator
import org.mobilenativefoundation.store.store5.impl.extensions.now
import org.mobilenativefoundation.store.store5.test_utils.model.OutputNote
import org.mobilenativefoundation.store.store5.util.model.OutputNote

internal class NotesValidator(private val expiration: Long = now()) : Validator<OutputNote> {
override suspend fun isValid(item: OutputNote): Boolean =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.mobilenativefoundation.store.store5.test_utils.fake.fallback
package org.mobilenativefoundation.store.store5.util.fake.fallback

class HardcodedPages {
val name = "HardcodedPages"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.mobilenativefoundation.store.store5.test_utils.fake.fallback
package org.mobilenativefoundation.store.store5.util.fake.fallback

sealed class Page {
data class Data(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.mobilenativefoundation.store.store5.test_utils.fake.fallback
package org.mobilenativefoundation.store.store5.util.fake.fallback

class PagesDatabase {
private val db: MutableMap<String, Page?> = mutableMapOf()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.mobilenativefoundation.store.store5.test_utils.fake.fallback
package org.mobilenativefoundation.store.store5.util.fake.fallback

class PrimaryPagesApi {
val name = "PrimaryPagesApi"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.mobilenativefoundation.store.store5.test_utils.fake.fallback
package org.mobilenativefoundation.store.store5.util.fake.fallback

class SecondaryPagesApi() {
val name: String = "SecondaryPagesApi"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.mobilenativefoundation.store.store5.test_utils.model
package org.mobilenativefoundation.store.store5.util.model

import org.mobilenativefoundation.store.store5.test_utils.fake.NotesKey
import org.mobilenativefoundation.store.store5.util.fake.NotesKey

internal sealed class NoteData {
data class Single(val item: Note) : NoteData()
Expand Down

0 comments on commit 6d9c058

Please sign in to comment.