Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix tests and expand scope of tests #46

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
- uses: actions/setup-node@v2

- run: npm ci
- run: npm run test -- ./src/lib/ --runInBand
- run: npm run test
3 changes: 3 additions & 0 deletions src/lib/__tests__/messages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ describe("Messages Library", () => {
});

test("formatActors should format actors into a readable string", () => {
console.log("*** actors", actors);
const formattedActors = formatActors({ actors });
console.log("*** formattedActors", formattedActors);
actors.forEach((actor) => {
console.log("*** actor.name", actor.name);
expect(formattedActors).toContain(actor.name);
});
});
Expand Down
3 changes: 2 additions & 1 deletion src/lib/actions/__tests__/continue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Content, type Message } from "../../types";
import action from "../continue";
import ignore from "../ignore";
import { zeroUuid } from "../../constants";
import wait from "../wait";

dotenv.config({ path: ".dev.vars" });

Expand Down Expand Up @@ -52,7 +53,7 @@ describe("User Profile", () => {
beforeAll(async () => {
const setup = await createRuntime({
env: process.env as Record<string, string>,
actions: [action, ignore],
actions: [action, ignore, wait],
});
user = setup.session.user;
runtime = setup.runtime;
Expand Down
8 changes: 4 additions & 4 deletions src/lib/actions/__tests__/ignore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ describe("Ignore action tests", () => {
senderId: user?.id as UUID,
agentId: zeroUuid,
userIds: [user?.id as UUID, zeroUuid],
content: { content: "Never talk to me again" },
content: { content: "Never talk to me again", action: "WAIT" },
room_id: room_id as UUID,
};

Expand All @@ -212,7 +212,7 @@ describe("Ignore action tests", () => {
senderId: user.id as UUID,
agentId: zeroUuid,
userIds: [user?.id as UUID, zeroUuid],
content: { content: "" },
content: { content: "", action: "IGNORE" },
room_id: room_id as UUID,
};

Expand All @@ -239,7 +239,7 @@ describe("Ignore action tests", () => {
senderId: user.id as UUID,
agentId: zeroUuid,
userIds: [user?.id as UUID, zeroUuid],
content: { content: "" },
content: { content: "", action: "IGNORE" },
room_id: room_id as UUID,
};

Expand All @@ -264,7 +264,7 @@ describe("Ignore action tests", () => {
senderId: user.id as UUID,
agentId: zeroUuid,
userIds: [user?.id as UUID, zeroUuid],
content: { content: "Bye" },
content: { content: "Bye", action: "WAIT" },
room_id: room_id as UUID,
};

Expand Down
2 changes: 1 addition & 1 deletion src/lib/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function getActorDetails({
*/
export function formatActors({ actors }: { actors: Actor[] }) {
const actorStrings = actors.map((actor: Actor) => {
const header = `${actor.name}${actor.details.tagline ? ": " + actor.details.tagline : ""}\n${actor.details.summary || "No information available"}`;
const header = `${actor.name}${actor.details.tagline ? ": " + actor.details.tagline : ""}${actor.details?.summary ? "\n" + actor.details?.summary : ""}`;
return header;
});
const finalActorStrings = actorStrings.join("\n");
Expand Down
4 changes: 2 additions & 2 deletions src/test/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ export const SUPABASE_ANON_KEY =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InByb252enJ6ZndzcHRrb2p2dWRkIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDY4NTYwNDcsImV4cCI6MjAyMjQzMjA0N30.I6_-XrqssUb2SWYg5DjsUqSodNS3_RPoET3-aPdqywM";
export const TEST_EMAIL = "[email protected]";
export const TEST_PASSWORD = "[email protected]";
export const TEST_EMAIL_2 = "testuser123@gmail.com";
export const TEST_PASSWORD_2 = "testuser123@gmail.com";
export const TEST_EMAIL_2 = "testuser234@gmail.com";
export const TEST_PASSWORD_2 = "testuser234@gmail.com";
Loading