Seeking advice on dependency injection and mocking for testing a CLI application using Effect/CLI
Hey! This is probably a really simple solution, but my head can't wrap itself around it for some reason. I'm building a CLI application and in it I'm using hardcoded config values, like directory paths etc. I also use Node's built-in fs module, however I now want to start writing some tests for this application and to do that I need to fix my implementation to rely more on DI. The way I believe this works is that I create an interface that decides which functions should exist and then I create two versions of that interface. One that has the actual version that should be used in production, and another that is the mocked version that I decide what I want it to do
Should I create my own mock of the prompt module of effect/cli or is there an easier way to do it? I got some help from @dmmulroy who let his Claude Code run a bit to give me something to work on. However while it gave me some groundwork, I feel like it has caused the same amount of problems. The test branch can be found here.
Thanks in advance!
Should I create my own mock of the prompt module of effect/cli or is there an easier way to do it? I got some help from @dmmulroy who let his Claude Code run a bit to give me something to work on. However while it gave me some groundwork, I feel like it has caused the same amount of problems. The test branch can be found here.
Thanks in advance!
