Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
minor
  • Loading branch information
c4spar committed Apr 3, 2023
commit b18f529ecf46161194c5701e09c05a5ecba6d680
10 changes: 6 additions & 4 deletions prompt/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@ function registerTest(options: AssertPromptSnapshotOptions) {
Deno.test({
name: options.name,
async fn(ctx) {
const tests = Object.entries(options.steps ?? {});
if (!tests.length) {
throw new Error(`No tests defined for: ${options.meta.url}`);
const steps = Object.entries(options.steps ?? {});
if (!steps.length) {
throw new Error(
`No steps defined for test: ${options.meta.name} -> ${options.meta.url}`,
);
}

for (const [name, inputs] of tests) {
for (const [name, inputs] of steps) {
await ctx.step({
name,
async fn(stepCtx) {
Expand Down