diff --git a/src/actions.test.todo b/src/actions.test.todo index d1e45ee..174cfa2 100644 --- a/src/actions.test.todo +++ b/src/actions.test.todo @@ -5,24 +5,6 @@ import { action } from './actions.js'; import { Updux } from './Updux.js'; -test('Updux config accepts actions', () => { - const foo = new Updux({ - actions: { - one: action('one', (x) => ({ x })), - two: action('two', (x) => x), - }, - }); - - expect(Object.keys(foo.actions)).toHaveLength(2); - - expect(foo.actions.one).toBeTypeOf('function'); - expect(foo.actions.one('potato')).toEqual({ - type: 'one', - payload: { - x: 'potato', - }, - }); -}); test('throw if double action', () => { diff --git a/src/actions.test.ts b/src/actions.test.ts index c051266..99fdeb9 100644 --- a/src/actions.test.ts +++ b/src/actions.test.ts @@ -39,3 +39,28 @@ test('subduxes actions', () => { expect(foo.actions.bar(2)).toHaveProperty('type', 'bar'); expect(foo.actions.baz()).toHaveProperty('type', 'baz'); }); + +test('Updux config accepts actions', () => { + const foo = new Updux({ + actions: { + one: createAction( + 'one', + withPayload((x) => ({ x })), + ), + two: createAction( + 'two', + withPayload((x) => x), + ), + }, + }); + + expect(Object.keys(foo.actions)).toHaveLength(2); + + expect(foo.actions.one).toBeTypeOf('function'); + expect(foo.actions.one('potato')).toEqual({ + type: 'one', + payload: { + x: 'potato', + }, + }); +});