diff --git a/src/test/select.test.ts b/src/test/select.test.ts index 044a8d4..eccd069 100644 --- a/src/test/select.test.ts +++ b/src/test/select.test.ts @@ -4,6 +4,21 @@ import { select } from '../select' describe(select, () => { + test('proxies a source.', () => { + const src = new State(0) + const selected = select(src) + + const cb = jest.fn() + + observe($ => cb($(selected)!)) + + src.set(1) + expect(cb).toHaveBeenCalledWith(1) + + src.set(2) + expect(cb).toHaveBeenCalledWith(2) + }) + test('without select, higher order sources are stopped after switch.', () => { const flag = new State(false) const a = new State('a')