FullStack-Swift / TodoList

Examples App Todo for Composable Architecture with UIKit and SwiftUI, and with RxSwift, ReactiveSwift and Combine
22 stars 8 forks source link

Unit test #3

Open JohnEtas9 opened 2 years ago

JohnEtas9 commented 2 years ago

Hi nguyen come across with composable architecture,

would you mind provide the sample for unit test as well, it would be more pleasure to have it 😄

Thank you

NguyenPhongVN commented 2 years ago

Hi JohnEtas9. I don't have time for this, you can test simple like:

        let store = Store(initialState: CounterState(), reducer: CounterReducer, environment: CounterEnvironment())
        let viewStore = ViewStore(store)
        viewStore.send(.increment)
        viewStore.publisher.sink { value in
            XCTAssertEqual(1, value.count)
        }
        .store(in: &cancellables)
NguyenPhongVN commented 2 years ago

I welcome any contribution, if you have any idea, suggestion, let me know @JohnEtas9