20 lines
520 B
JavaScript
20 lines
520 B
JavaScript
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.upreducer).toBeTypeOf('function');
|
|
|
|
expect(dux.upreducer({ type: 'foo' })({ a: 1 })).toMatchObject({ a: 1 }); // noop
|
|
});
|