@fragno-dev/chatno 0.0.13 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/package.json +2 -2
- package/src/index.test.ts +38 -5
- package/src/index.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @fragno-dev/chatno
|
|
2
2
|
|
|
3
|
+
## 0.0.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [09a1e13]
|
|
8
|
+
- @fragno-dev/core@0.1.7
|
|
9
|
+
|
|
10
|
+
## 0.0.14
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [be1a630]
|
|
15
|
+
- Updated dependencies [b2a88aa]
|
|
16
|
+
- Updated dependencies [a9f8159]
|
|
17
|
+
- Updated dependencies [9d4cd3a]
|
|
18
|
+
- @fragno-dev/core@0.1.6
|
|
19
|
+
|
|
3
20
|
## 0.0.13
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fragno-dev/chatno",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"development": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"nanostores": "^1.0.1",
|
|
59
59
|
"openai": "^5.20.0",
|
|
60
60
|
"zod": "^4.0.5",
|
|
61
|
-
"@fragno-dev/core": "0.1.
|
|
61
|
+
"@fragno-dev/core": "0.1.7"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"typescript": "^5.9.3",
|
package/src/index.test.ts
CHANGED
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
import { describe, it, expect, assert } from "vitest";
|
|
2
2
|
import { createFragmentForTest } from "@fragno-dev/core/test";
|
|
3
|
-
import { chatnoDefinition,
|
|
3
|
+
import { chatnoDefinition, healthRoute, simpleStreamRoute } from "./index";
|
|
4
|
+
import { chatRouteFactory } from "./server/chatno-api";
|
|
4
5
|
|
|
5
6
|
describe("chatno", () => {
|
|
6
|
-
const
|
|
7
|
+
const routes = [chatRouteFactory, healthRoute, simpleStreamRoute] as const;
|
|
8
|
+
const fragment = createFragmentForTest(chatnoDefinition, routes, {
|
|
7
9
|
config: {
|
|
8
10
|
openaiApiKey: "test-key",
|
|
9
11
|
},
|
|
10
12
|
});
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
// Test with just healthRoute
|
|
15
|
+
const fragmentJustHealth = createFragmentForTest(chatnoDefinition, [healthRoute] as const, {
|
|
16
|
+
config: {
|
|
17
|
+
openaiApiKey: "test-key",
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Test with just a factory
|
|
22
|
+
const fragmentJustFactory = createFragmentForTest(
|
|
23
|
+
chatnoDefinition,
|
|
24
|
+
[simpleStreamRoute] as const,
|
|
25
|
+
{
|
|
26
|
+
config: {
|
|
27
|
+
openaiApiKey: "test-key",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
);
|
|
13
31
|
|
|
14
32
|
it("services - should return OpenAI URL from getOpenAIURL service", () => {
|
|
15
33
|
const openaiURL = fragment.services.getOpenAIURL();
|
|
@@ -34,7 +52,7 @@ describe("chatno", () => {
|
|
|
34
52
|
});
|
|
35
53
|
|
|
36
54
|
it("routes - should return simple stream", async () => {
|
|
37
|
-
const response = await fragment.
|
|
55
|
+
const response = await fragment.callRoute("GET", "/simple-stream");
|
|
38
56
|
|
|
39
57
|
assert(response.type === "jsonStream");
|
|
40
58
|
const items = [];
|
|
@@ -57,10 +75,25 @@ describe("chatno", () => {
|
|
|
57
75
|
});
|
|
58
76
|
|
|
59
77
|
it("routes - should test health route", async () => {
|
|
60
|
-
const response = await fragment.
|
|
78
|
+
const response = await fragment.callRoute("GET", "/health");
|
|
61
79
|
|
|
62
80
|
assert(response.type === "json");
|
|
63
81
|
expect(response.status).toBe(200);
|
|
64
82
|
expect(response.data).toEqual({ status: "ok" });
|
|
65
83
|
});
|
|
84
|
+
|
|
85
|
+
it("routes - should test health route with simple fragment", async () => {
|
|
86
|
+
const response = await fragmentJustHealth.callRoute("GET", "/health");
|
|
87
|
+
|
|
88
|
+
assert(response.type === "json");
|
|
89
|
+
expect(response.status).toBe(200);
|
|
90
|
+
expect(response.data).toEqual({ status: "ok" });
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it("routes - should test simple stream with factory fragment", async () => {
|
|
94
|
+
const response = await fragmentJustFactory.callRoute("GET", "/simple-stream");
|
|
95
|
+
|
|
96
|
+
assert(response.type === "jsonStream");
|
|
97
|
+
expect(response.status).toBe(200);
|
|
98
|
+
});
|
|
66
99
|
});
|
package/src/index.ts
CHANGED