updux/dist/buildInitial.test.js

15 lines
425 B
JavaScript
Raw Normal View History

2025-01-31 18:16:41 +00:00
import { test, expect } from 'vitest';
import { buildInitial } from './initial.js';
test('basic', () => {
expect(buildInitial({ a: 1 }, { b: { initialState: { c: 2 } }, d: { initialState: 'e' } })).toEqual({
a: 1,
b: { c: 2 },
d: 'e',
});
});
test('throw if subduxes and initialState is not an object', () => {
expect(() => {
buildInitial(3, { bar: 'foo' });
}).toThrow();
});