Advice on Testing Services with Effect and What to Focus On

I am quite new to Effect and a little less to backend, I've been doing some backend for personal projects but only lately been working more on the backend side of projects. I'm trying to figure out the best way to test services and what needs to be tested actually .
I've searched for some examples of testes and found this repo: https://github.com/Effect-TS/examples/tree/main/examples/http-server, I couldn't find anything regarding tests with Effect. I've copied their makeTestLayer that allows us to define the service

So I have this service:
export class ServiceOfferRepositoryLive extends Effect.Service<ServiceOfferRepositoryLive>()(
  'ServiceOfferRepositoryLive',
  {
    dependencies: [DatabaseClient.Default],
    effect: Effect.gen(function* () {
      const dbClient = yield* DatabaseClient;

      const findById = (id: string) => { ... // The implementation }

      return { findById } as const;
    }),
  },
) {
  static Test = makeTestLayer(ServiceOfferRepositoryLive)({});
}

And then in our tests we can define what the Service will return.

Is this a good good approach for testing? (I guess if it was created by the creators of the library it must be 😄 )

The other point is what should I be testing? In this example, I have a Repository, what it does is simply fetching data from the database, if it finds the if of the resource it returns otherwise it returns undefined, and if there's a problem with the database it throws an error. Is there any real benefit in testing this or should I simply test ServiceOfferServiceLive that depends on ServiceOfferRepositoryLive ?

Thanks a lot for your help.
Was this page helpful?