Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Sets up a Groq local development loop with a memoized client, model constants, and mocked plus live test tiers.
52% 91%+39 ptsof test cases passed
Passed 21 of 23 test cases with the skill, and 12 of 23 without it.
What specific environment variable flag is used to conditionally enable live API integration testing in the Groq local dev loop setup?
uses GROQ_INTEGRATION
3 of 3 safety checks passed
The two-tier test strategy: fast mocked unit tests that run on every save with
zero API calls, and opt-in integration tests that hit the live API only when
GROQ_INTEGRATION=1 is set (CI or manual verification).
Mock the entire groq-sdk module so unit tests never touch the network. This
keeps vitest --watch sub-second and free of quota usage.
// tests/groq.test.ts
import { describe, it, expect, vi, beforeEach } from "vitest";
import Groq from "groq-sdk";
// Mock the entire groq-sdk module
vi.mock("groq-sdk", () => {
const mockCreate = vi.fn().mockResolvedValue({
choices: [{ message: { content: "mocked response" }, finish_reason: "stop" }],
usage: { prompt_tokens: 10, completion_tokens: 5, total_tokens: 15 },
model: "llama-3.1-8b-instant",
});
return {
default: vi.fn(() => ({
chat: { completions: { create: mockCreate } },
models: { list: vi.fn().mockResolvedValue({ data: [] }) },
})),
};
});
describe("Groq Completions", () => {
it("should create a chat completion", async () => {
const groq = new Groq();
const result = await groq.chat.completions.create({
model: "llama-3.1-8b-instant",
messages: [{ role: "user", content: "test" }],
});
Next to this one in the catalogue, plus more from the same author.