Skip to content

Commit

Permalink
Fix relationship issues in messages test
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalune committed Feb 23, 2024
1 parent 3022e50 commit 60d4dd6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 63 deletions.
49 changes: 0 additions & 49 deletions docs/docs/interfaces/Relationship.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/docs/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ custom_edit_url: null
- [Message](interfaces/Message.md)
- [MessageExample](interfaces/MessageExample.md)
- [Objective](interfaces/Objective.md)
- [Relationship](interfaces/Relationship.md)
- [State](interfaces/State.md)

## Type Aliases
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
"jsnext:main": "dist/index.esm.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "rimraf ./dist && rollup -c && tsc",
"build": "rimraf ./dist && rollup -c && tsc && npm run build:docs",
"build:docs": "cd docs && npm run build",
"lint": "eslint --ext .ts --ext .js . --fix",
"dev": "wrangler dev -- --dev",
"docs": "cd docs && npm run start",
"start:docs": "cd docs && npm run start",
"shell:dev": "node --no-warnings scripts/shell.mjs --dev",
"concat": "node ./scripts/concat.mjs",
"shell:cloud": "node --no-warnings scripts/shell.mjs",
Expand Down
18 changes: 7 additions & 11 deletions src/lib/__tests__/messages.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { type User } from "@supabase/supabase-js";
import { type UUID } from "crypto";
import { createRuntime } from "../../test/createRuntime";
import {
formatMessageActors,
formatMessages,
getMessageActors,
} from "../messages";
import { formatActors, formatMessages, getActorDetails } from "../messages";
import { type BgentRuntime } from "../runtime";
import { type Actor, type Content, type Memory } from "../types";
import { formatSummarizations } from "../evaluators/summarization";
Expand All @@ -19,27 +15,27 @@ describe("Messages Library", () => {
});
runtime = setup.runtime;
user = setup.session.user;
actors = await getMessageActors({
actors = await getActorDetails({
runtime,
userIds: [user.id as UUID, "00000000-0000-0000-0000-000000000000"],
});
});

test("getMessageActors should return actors based on given userIds", async () => {
const result = await getMessageActors({
test("getActorDetails should return actors based on given userIds", async () => {
const result = await getActorDetails({
runtime,
userIds: [user.id as UUID, "00000000-0000-0000-0000-000000000000"],
});
expect(result.length).toBeGreaterThan(0);
result.forEach((actor) => {
result.forEach((actor: Actor) => {
expect(actor).toHaveProperty("name");
expect(actor).toHaveProperty("details");
expect(actor).toHaveProperty("id");
});
});

test("formatMessageActors should format actors into a readable string", () => {
const formattedActors = formatMessageActors({ actors });
test("formatActors should format actors into a readable string", () => {
const formattedActors = formatActors({ actors });
actors.forEach((actor) => {
expect(formattedActors).toContain(actor.name);
});
Expand Down

0 comments on commit 60d4dd6

Please sign in to comment.