interface TagImpl {
say: () => Effect.Effect<void, never, never>;
}
class Tag extends Context.Tag('...')<Tag, TagImpl>() {}
const Live = Layer.succeed(Tag, { say: () => Console.log('local') });
const program = Effect.gen(function* () {
const service = yield* Tag;
yield* service.say();
})
const runnable = program.pipe(Effect.provide(Live));
const ComponentWithLogic = () => {
useProgram(runnable);
return <div>Wow</div>
}
describe('some ui-test', () => {
it('should update', () => {
const LiveTest = Layer.succeed(Tag, { say: () => Console.log('only for test') });
const App = <LiveContext.Provider value={LiveTest}><ComponentWithLogic /><LiveContext.Provider>
render(<App />)
....
})
})
interface TagImpl {
say: () => Effect.Effect<void, never, never>;
}
class Tag extends Context.Tag('...')<Tag, TagImpl>() {}
const Live = Layer.succeed(Tag, { say: () => Console.log('local') });
const program = Effect.gen(function* () {
const service = yield* Tag;
yield* service.say();
})
const runnable = program.pipe(Effect.provide(Live));
const ComponentWithLogic = () => {
useProgram(runnable);
return <div>Wow</div>
}
describe('some ui-test', () => {
it('should update', () => {
const LiveTest = Layer.succeed(Tag, { say: () => Console.log('only for test') });
const App = <LiveContext.Provider value={LiveTest}><ComponentWithLogic /><LiveContext.Provider>
render(<App />)
....
})
})