This repository contains a minimal, runnable example of how to unit test a Genkit flow using Jest.
The main goal is to test your specific business logic (how you build prompts and handle outputs) without actually calling a live AI model. This makes your tests super fast, reliable, and free.
The trick is to use jest.spyOn to "intercept" the ai.generate method. In our test, we tell it, "Hey, whenever you're called, don't go to the internet; just pretend the AI responded with this exact text."
This isolates your code from the external dependency, which is the whole point of a unit test.