Есть вот такой редюсер
export const sdk = new NPROneSDK()
// Nearby
export const NPRONE_NEAR_BY = 'nprone/NPRONE_NEARBY'
export const getNearBy = () => dispatch => {
console.info('getNearBy')
return sdk.searchStations('94708')
.then(nearBy => {
dispatch(setNearBy(nearBy))
})
.catch(e => {
onNearByError(e)
throw (e)
})
}
const setNearBy = (payload) => {
console.info('setNearBy', payload)
return {
type: NPRONE_NEAR_BY,
payload
}
}
const onNearByError = (error) => {
console.error('onNearByError', error)
}
// ------------------------------------
// Action Handlers
// ------------------------------------
const ACTION_HANDLERS = {
[NPRONE_NEAR_BY]: (state, action) => Object.assign({}, state, {nearBy: action.payload})
}
const initialState = {
nearBy: []
}
export default function nprOneReducer (state = initialState, action) {
const handler = ACTION_HANDLERS[action.type]
return handler ? handler(state, action) : state
}
Не получается сделать тест.
import {NPRONE_NEAR_BY} from '../src/store/reducers/nprone'
import * as actions from '../src/store/reducers/nprone'
describe('actions', () => {
it('should create an action to add a todo', () => {
const expectedAction = {
type: NPRONE_NEAR_BY
}
expect(actions.getNearBy()).toEqual(expectedAction)
})
})
Выдает вот такую ошибку
import { NPRONE_NEAR_BY } from '../src/store/reducers/nprone';
^^^^^^
Что я неправильно делаю?