/* imports omitted for brevity */
const handler = RpcRouter.toHandler(appRouter);
const resolver = RpcResolver.make(handler)<typeof appRouter>()
const withCtx = RequestResolver.contextFromServices(PgRootDB)(resolver)
const client = RpcResolver.toClient(withCtx)
describe("posts", () => {
it.live("can make a new post", () =>
Effect.gen(function* () {
const result = yield* client(new CreatePost({ body: "hello world" }));
Effect.log(result)
expect(result).toBeInstanceOf(Object);
expect(result.body).toEqual("hello world");
}).pipe(
Effect.provide(PgRootLive),
Effect.provide(PgClient.layer({ url: Config.redacted("DATABASE_URL") })),
)
);
// more tests
});
/* imports omitted for brevity */
const handler = RpcRouter.toHandler(appRouter);
const resolver = RpcResolver.make(handler)<typeof appRouter>()
const withCtx = RequestResolver.contextFromServices(PgRootDB)(resolver)
const client = RpcResolver.toClient(withCtx)
describe("posts", () => {
it.live("can make a new post", () =>
Effect.gen(function* () {
const result = yield* client(new CreatePost({ body: "hello world" }));
Effect.log(result)
expect(result).toBeInstanceOf(Object);
expect(result.body).toEqual("hello world");
}).pipe(
Effect.provide(PgRootLive),
Effect.provide(PgClient.layer({ url: Config.redacted("DATABASE_URL") })),
)
);
// more tests
});