Skip to content
This repository was archived by the owner on May 29, 2026. It is now read-only.

Commit 9afa980

Browse files
committed
adding basic tests
1 parent 62289c3 commit 9afa980

6 files changed

Lines changed: 80 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "runtime-sample",
3+
"version": "2.0.6",
4+
"license": "MIT",
5+
"private": true,
6+
"type": "module",
7+
"scripts": {
8+
"format:check": "prettier --config ../../.prettierrc.json --ignore-path ../../.prettierignore --check \"genaisrc/**/*.{ts,cts,mts,mjs}\" \"*.{js,cjs,mjs,json,mjs}\" ",
9+
"format:fix": "prettier --config ../../.prettierrc.json --ignore-path ../../.prettierignore --write \"genaisrc/**/*.{ts,cts,mts,mjs}\" \"*.{js,cjs,mjs,json,mjs}\" ",
10+
"test": "vitest --run"
11+
},
12+
"dependencies": {
13+
"@genaiscript/runtime": "workspace:*"
14+
},
15+
"devDependencies": {
16+
"@types/node": "catalog:",
17+
"p-all": "^5.0.0",
18+
"vitest": "catalog:",
19+
"zod": "^3.25.67",
20+
"zod-to-json-schema": "^3.24.5",
21+
"zx": "catalog:"
22+
}
23+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { prompt } from "@genaiscript/runtime";
2+
3+
export async function writePoem() {
4+
const res = await prompt`write a poem`;
5+
return res.text;
6+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { prompt } from "@genaiscript/runtime";
2+
3+
const res = await prompt`write a poem`;
4+
console.log(res.text);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { prompt } from "@genaiscript/runtime";
2+
3+
const res = await prompt`write a poem`;
4+
console.log(res.text);
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
import { describe, test, assert, beforeEach } from "vitest";
5+
import { writePoem } from "../src/poem-function";
6+
7+
describe(`runtime`, () => {
8+
test(`dynamic import`, async () => {
9+
const { prompt } = await import("@genaiscript/runtime");
10+
const res = await prompt`write a poem`;
11+
console.log(res.text);
12+
// Add assertions if needed
13+
});
14+
15+
test(`poem function`, async () => {
16+
await writePoem();
17+
});
18+
});

pnpm-lock.yaml

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)