import reducer, { INITIAL_STATE } from '.' import type { UpdateEditAction } from '../actions' describe('reducer', () => { it('should prepare initial state', () => { expect(Object.keys(INITIAL_STATE)).toContain('rows') }) describe('when a change occurs', () => { it('should return new state', () => { const initialState = INITIAL_STATE const action: UpdateEditAction = { type: 'updateEdit', payload: { rowId: '1', columnId: '2', }, } const state = reducer(INITIAL_STATE, action) expect(initialState).not.toBe(state) }) }) describe('when no change occurs', () => { it('should return the same state', () => { const initialState = INITIAL_STATE const action: UpdateEditAction = { type: 'updateEdit', payload: null, } const state = reducer(INITIAL_STATE, action) expect(initialState).toBe(state) }) }) })