Skip to content

huangjeff5/genkit-testing-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published