<commit_before>package com.reduks.reduks

import com.reduks.reduks.repository.FakeActions
import com.reduks.reduks.repository.FakeData
import com.reduks.reduks.repository.FakeState
import com.reduks.reduks.subscription.Subscriber
import com.reduks.reduks.subscription.Subscription
import org.jetbrains.spek.api.Spek
import org.jetbrains.spek.api.dsl.given
import org.jetbrains.spek.api.dsl.it
import org.junit.platform.runner.JUnitPlatform
import org.junit.runner.RunWith
import kotlin.test.assertTrue

@RunWith(JUnitPlatform::class)
class StoreTest : Spek({

    given("subscriptions") {

        val subscription = Subscription {
            assertTrue(true)
        }

        val subscriber = Subscriber<FakeState> { state ->
            assertTrue(state.name.toLowerCase().trim() == "bloder")
        }

        beforeEach {
            FakeData.store.subscribe(subscriber)
        }

        it("should return a transformed state in subscriber state changed action") {
            FakeData.store.dispatch(FakeActions.SetValidState())
        }

        it("confirm that unsubscribing works") {
            subscription.unsubscribe()
        }

        it("should return updated state when I get it from store") {
            FakeData.store.subscribe(Subscriber {})
            FakeData.store.dispatch(FakeActions.SetValidState())
            assertTrue { FakeData.store.getState().name.trim().toLowerCase() == "bloder" }
        }

    }<commit_msg>Separe store state test in a different context<commit_after>package com.reduks.reduks

import com.reduks.reduks.repository.FakeActions
import com.reduks.reduks.repository.FakeData
import com.reduks.reduks.repository.FakeState
import com.reduks.reduks.subscription.Subscriber
import com.reduks.reduks.subscription.Subscription
import org.jetbrains.spek.api.Spek
import org.jetbrains.spek.api.dsl.given
import org.jetbrains.spek.api.dsl.it
import org.junit.platform.runner.JUnitPlatform
import org.junit.runner.RunWith
import kotlin.test.assertTrue

@RunWith(JUnitPlatform::class)
class StoreTest : Spek({

    given("subscriptions") {

        val subscription = Subscription {
            assertTrue(true)
        }

        val subscriber = Subscriber<FakeState> { state ->
            assertTrue(state.name.toLowerCase().trim() == "bloder")
        }

        beforeEach {
            FakeData.store.subscribe(subscriber)
        }

        it("should return a transformed state in subscriber state changed action") {
            FakeData.store.dispatch(FakeActions.SetValidState())
        }

        it("confirm that unsubscribing works") {
            subscription.unsubscribe()
        }

    }

    given("store state") {

        it("should return updated state when I get it from store") {
            FakeData.store.subscribe(Subscriber {})
            FakeData.store.dispatch(FakeActions.SetValidState())
            assertTrue { FakeData.store.getState().name.trim().toLowerCase() == "bloder" }
        }

    }
{'fraction_non_alphanumeric': 0.10342511752854265, 'fraction_numerical': 0.0, 'mean_word_length': 2.919736842105263, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2880552', 'n_tokens_mistral': 850, 'n_tokens_neox': 836, 'n_words': 153}