Overriding Dependencies in `Effect.Service` for Testing Purposes

Is it possible to override the dependency declared in
Effect.Service
? so you can test a service with dummy input, see a very contrived example below

class FourtyTwo extends Effect.Service<FourtyTwo>()("fourtytwo", {
  dependencies: [],
  effect: Effect.gen(function* () {
    return { val: 42 };
  }),
}) {}

class IsFoutryTwo extends Effect.Service<IsFoutryTwo>()("IsFoutryTwo", {
  dependencies: [FourtyTwo.Default], //👈overwrite this?
  effect: Effect.gen(function* () {
    const ft = yield* FourtyTwo;
    return { valid: ft.val === 42 };
  }),
}) {}
Was this page helpful?