updux/src/reducer.test.ts

20 lines
509 B
TypeScript

import { test, expect } from 'vitest';
import { Updux } from './Updux.js';
test('basic reducer', () => {
const dux = new Updux({ initial: {a: 3} });
expect(dux.reducer).toBeTypeOf('function');
expect(dux.reducer({ a: 1 }, { type: 'foo' })).toMatchObject({ a: 1 }); // noop
});
test('basic upreducer', () => {
const dux = new Updux({ initial: {a: 3} });
expect(dux.reducer).toBeTypeOf('function');
expect(dux.reducer({ type: 'foo' })({a:1})).toMatchObject({ a: 1 }); // noop
});