Elffuss BraidHub

kikocis/continue public

added tests
Changeset0bc8a18563fc1dd61b7d50e0e4f02af68b7947b86a1e71a378bea9b45e6f2837
Authoruinstinct <61635505+uinstinct@users.noreply.github.com> · 2025-05-23 11:40 +05:30
Committeruinstinct <61635505+uinstinct@users.noreply.github.com> · 2025-05-23 11:40 +05:30
Parentsed46f5b1432f

Browse the files at this changeset

1 file changed

modified core/data/log.test.ts +27 −0
@@ -18,6 +18,18 @@
1818 provider: "openai",
1919 },
2020 };
21+
22+const TEST_AGENT_INTERACTION_EVENT: DevDataLogEvent = {
23+ name: 'agentInteraction',
24+ data: {
25+ prompt: "Hello, world!",
26+ completion: "Hello, world!",
27+ modelProvider: "openai",
28+ modelTitle: "gpt-4",
29+ sessionId: "1234",
30+ },
31+}
32+
2133 const SCHEMA = "0.2.0";
2234
2335 describe("DataLogger", () => {
@@ -157,6 +169,21 @@
157169 expect(fileContent).toContain('"model":"gpt-4"');
158170 expect(fileContent).toContain('"eventName":"tokensGenerated"');
159171 });
172+
173+ it('should write agent interaction data to local file', async () => {
174+ // Call the method to log data locally
175+ await dataLogger.logLocalData(TEST_AGENT_INTERACTION_EVENT);
176+
177+ // Verify the file was created
178+ const filepath = getDevDataFilePath(TEST_AGENT_INTERACTION_EVENT.name, SCHEMA);
179+ expect(fs.existsSync(filepath)).toBe(true);
180+
181+ // Read file contents and verify
182+ const fileContent = fs.readFileSync(filepath, "utf8");
183+ expect(fileContent).toContain('"eventName":"agentInteraction"');
184+ expect(fileContent).toContain('"prompt":"Hello, world!"');
185+ expect(fileContent).toContain('"completion":"Hello, world!"');
186+ })
160187 });
161188
162189 describe("logDevData", () => {