TypeError: seamless immutable _1.default is not a function - React native jest unit testing (Typescript)

980 views Asked by At

I am trying jest unit testing for typescript based react native project.Now I am stuck on one issue when do npm test. Error mentioned below

● Test suite failed to run

TypeError: seamless_immutable_1.default is not a function

  34 | 
  35 | 
> 36 | export const INITIAL_STATE: ImmutableAppReducerState = Immutable({
     |                                                                 ^
  37 |   activeTab: 0,
  38 |   showTab: false,
  39 |   tabName: "",

My actual code was follows

import Immutable from "seamless-immutable";

export interface AppReducerState {
  activeTab?: number | undefined;
  showTab?: boolean | undefined;
  tabName?: string | undefined;
  isDrawerOpen: boolean;
  retryAction: AnyAction[];

}

/* ------------- Initial State ------------- */

type ImmutableAppReducerState = Immutable.Immutable<AppReducerState>


export const INITIAL_STATE: ImmutableAppReducerState = Immutable({
  activeTab: 0,
  showTab: false,
  tabName: "",
  isDrawerOpen: false,
  retryAction: [],

});
1

There are 1 answers

0
abdul sathar On BEST ANSWER

Answer to my question

Just modify my code

1. import * as Immutable from "seamless-immutable";

2. export const INITIAL_STATE: ImmutableAppReducerState = Immutable

to 

export const INITIAL_STATE: ImmutableAppReducerState = Immutable.from