@@ -18,12 +18,21 @@ import assert from 'node:assert';
18
18
import { describe , it } from 'node:test' ;
19
19
20
20
import { defineModel } from '@genkit-ai/ai/model' ;
21
- import z from 'zod' ;
22
-
23
21
import { toJsonSchema , ValidationError } from '@genkit-ai/core/schema' ;
22
+ import z from 'zod' ;
23
+ import { registerPluginProvider } from '../../../core/src/registry.js' ;
24
24
import { defineDotprompt , Dotprompt , prompt } from '../src/index.js' ;
25
25
import { PromptMetadata } from '../src/metadata.js' ;
26
26
27
+ function registerDotprompt ( ) {
28
+ registerPluginProvider ( 'dotprompt' , {
29
+ name : 'dotprompt' ,
30
+ async initializer ( ) {
31
+ return { } ;
32
+ } ,
33
+ } ) ;
34
+ }
35
+
27
36
const echo = defineModel (
28
37
{ name : 'echo' , supports : { tools : true } } ,
29
38
async ( input ) => ( {
@@ -62,6 +71,7 @@ describe('Prompt', () => {
62
71
} ) ;
63
72
64
73
it ( 'rejects input not matching the schema' , async ( ) => {
74
+ registerDotprompt ( ) ;
65
75
const invalidSchemaPrompt = defineDotprompt (
66
76
{
67
77
name : 'invalidInput' ,
@@ -90,6 +100,7 @@ describe('Prompt', () => {
90
100
} ) ;
91
101
92
102
it ( 'rejects input not matching the schema' , async ( ) => {
103
+ registerDotprompt ( ) ;
93
104
const invalidSchemaPrompt = defineDotprompt (
94
105
{
95
106
name : 'invalidInput' ,
@@ -176,6 +187,7 @@ output:
176
187
177
188
describe ( 'definePrompt' , ( ) => {
178
189
it ( 'registers a prompt and its variant' , async ( ) => {
190
+ registerDotprompt ( ) ;
179
191
defineDotprompt (
180
192
{
181
193
name : 'promptName' ,
0 commit comments