Skip to content
Discussion options

You must be logged in to vote

Have you tried using an immediate scheduler for there mainQueue during tests? For example, this test passes:

func testImmediateDebounce() async {
  enum Action { case tap }
  let store = TestStore(
    initialState: 0,
    reducer: Reducer<Int, Action, Void> { state, action, _ in
      return .fireAndForget {
      }
      .debounce(id: 1, for: 1, scheduler: DispatchQueue.immediate)

    },
    environment: ()
  )

  await store.send(.tap)
}

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@maxkazakov
Comment options

Comment options

You must be logged in to vote
3 replies
@maxkazakov
Comment options

@mbrandonw
Comment options

@maxkazakov
Comment options

Answer selected by maxkazakov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants