UNPKG

redux-action-pathify

Version:

A Redux utility for generating clear and unique action type strings using a nested path approach. This library helps in avoiding duplicate action names and makes action types more readable and maintainable.

18 lines (15 loc) 420 B
import { actionTypeGenerator, PATH } from './actionTypeGenerator'; describe('actionTypeGenerator', () => { it('should return correct actions', () => { const actionMap = { a: PATH, b: PATH, c: { d: PATH, e: PATH, f: { g: PATH } }, }; expect(actionTypeGenerator(actionMap)).toStrictEqual({ a: 'a', b: 'b', c: { d: 'c/d', e: 'c/e', f: { g: 'c/f/g' } }, }); }); });