daily pastebin goal
48%
SHARE
TWEET

Untitled

a guest Mar 25th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import Nimble
  2. import Quick
  3. import RxExpect
  4. import RxSwift
  5. import RxTest
  6. @testable import UnitTestPractical
  7.  
  8. class SampleListReactorTest: QuickSpec {
  9.     override func spec() {
  10.         var reactor: SampleListReactor!
  11.         var repository: SampleRepository!
  12.         beforeEach {
  13.             repository = SampleRepository()
  14.             reactor = SampleListReactor(repository)
  15.         }
  16.         describe("SampleListReactorTest") {
  17.             it("test search keyword 'a'", closure: {
  18.                
  19.                 let test = RxExpect()
  20.                 let reactor = test.retain(reactor)
  21.                 test.input(reactor.action, [
  22.                     next(200, .search("a"))
  23.                     ])
  24.                
  25.                 let expectSection = [MySection(header: "Items", items: repository.expect.map { $0.title })]
  26.                 test.assert(reactor.state) { events in
  27.                     expect(events.elements.count) == 2
  28.                     expect(events.elements[0].items) == []
  29.                     expect(events.elements[1].items) == expectSection
  30.                 }
  31.             })
  32.         }
  33.     }
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top