Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Issues when unit testing Reducer #236

Open
hypr2771 opened this issue Nov 21, 2018 · 0 comments
Open

Issues when unit testing Reducer #236

hypr2771 opened this issue Nov 21, 2018 · 0 comments

Comments

@hypr2771
Copy link

Hi,

first of all, I appreciate a lot your work and your sharing.
I also doubt it's due to the project as is, but I am running into an error when trying to unit test Adding a reducer as suggested.

My test is the following

// src/reducers/index.test.tsx

import {EnthusiasmAction, incrementEnthusiasm} from "../actions";
import {IStoreState}                           from "../types";
import {enthusiasm}                            from "./index";

it('reducers should increment state', cb => {
  const givenState: IStoreState = {
    enthusiasmLevel: 1,
    languageName: 'JavaScript'
  }

  const action: EnthusiasmAction = incrementEnthusiasm()

  const expectedState: IStoreState = {
    enthusiasmLevel: 2,
    languageName: 'JavaScript'
  }

  expect(enthusiasm(givenState, action))
    .toEqual(expectedState)
})

and the error is the following

Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.

    at pTimeout (/home/castelluciv/Workspace/Project/Marketplace/marketplace-front/node_modules/jest-jasmine2/build/queueRunner.js:53:21)
    at Timeout.setTimeout (/home/castelluciv/Workspace/Project/Marketplace/marketplace-front/node_modules/jest-jasmine2/build/p-timeout.js:21:44)
    at listOnTimeout (timers.js:324:15)
    at processTimers (timers.js:268:5)

I have read StackOverflow and GitHub issues about it but my instinct and my past experiences with asynchronous frameworks suggest me something is not yet terminated (while people mostly suggest increasing Jasmine timeout), so I guess I am doing something wrong.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant