Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should transfer unresolved state', () => {
const from$ = constant.unresolved();
const to$ = atom(123);
copyState(from$, to$);
expect(to$.resolved).to.be.false;
});
it('should support lifecycle options', () => {
const a$ = atom(0);
const unresolved$ = constant.unresolved();
const error = new Error('this is not good!');
const d$ = a$.derive(v => {
switch (v) {
case 0: return 42;
case 1: throw error;
default: return unresolved$.get() + 42;
}
});
const until = atom(false);
const target$ = atom.unresolved();
syncState(d$, target$, { until });
expect(target$.value).to.equal(42);
a$.set(1);