You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.1 KiB
Kotlin
35 lines
1.1 KiB
Kotlin
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
package org.mozilla.fenix.library.bookmarks
|
|
|
|
import kotlinx.coroutines.test.runTest
|
|
import org.junit.Assert.assertEquals
|
|
import org.junit.Assert.assertNotSame
|
|
import org.junit.Test
|
|
|
|
class BookmarkSearchFragmentStoreTest {
|
|
|
|
@Test
|
|
fun `GIVEN createInitialBookmarkSearchFragmentState THEN query is empty`() {
|
|
val expected = BookmarkSearchFragmentState(query = "")
|
|
|
|
assertEquals(
|
|
expected,
|
|
createInitialBookmarkSearchFragmentState(),
|
|
)
|
|
}
|
|
|
|
@Test
|
|
fun updateQuery() = runTest {
|
|
val initialState = BookmarkSearchFragmentState(query = "")
|
|
val store = BookmarkSearchFragmentStore(initialState)
|
|
val query = "test query"
|
|
|
|
store.dispatch(BookmarkSearchFragmentAction.UpdateQuery(query)).join()
|
|
assertNotSame(initialState, store.state)
|
|
assertEquals(query, store.state.query)
|
|
}
|
|
}
|