processResponse.spec.ts 909 B

1234567891011121314151617181920212223242526272829303132
  1. import { describe, expect, test } from "@jest/globals";
  2. import { Screenplay } from "../src/features/chat/messages";
  3. import { processResponse } from "../src/utils/processResponse";
  4. describe("Process Response Tests", () => {
  5. test("should return same thing", () => {
  6. const sentences: string[] = []
  7. const aiTextLog = "";
  8. const receivedMessage = "";
  9. const tag = "";
  10. let cbTriggered = false;
  11. const proc = processResponse({
  12. sentences,
  13. aiTextLog,
  14. receivedMessage,
  15. tag,
  16. callback: (aiTalks: Screenplay[]) => {
  17. cbTriggered = true;
  18. expect(aiTalks).toEqual([]);
  19. return false;
  20. },
  21. });
  22. expect(proc.sentences).toStrictEqual([]);
  23. expect(proc.aiTextLog).toBe("");
  24. expect(proc.receivedMessage).toBe("");
  25. expect(proc.tag).toBe("");
  26. expect(proc.shouldBreak).toBe(false);
  27. expect(cbTriggered).toBe(false);
  28. });
  29. });