useZCodeTaskService.test.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import { describe, expect, it } from "vitest";
  2. import { buildSnapshotDedupeKey } from "../src/hooks/useZCodeTaskService.js";
  3. describe("buildSnapshotDedupeKey", () => {
  4. it("separates replayable snapshots by historical model hint", () => {
  5. const base = {
  6. taskId: "task-1",
  7. workspacePath: "/workspace/demo",
  8. workspaceIdentity: "ssh://host/workspace/demo",
  9. clientMode: "web-remote-replayable" as const,
  10. messageLimit: 10,
  11. };
  12. expect(
  13. buildSnapshotDedupeKey({
  14. ...base,
  15. model: "default-deepseek/deepseek-v4-flash",
  16. }),
  17. ).not.toBe(
  18. buildSnapshotDedupeKey({
  19. ...base,
  20. model: "bigmodel-api/GLM-5.1",
  21. }),
  22. );
  23. });
  24. it("separates replayable snapshots by historical thought level hint", () => {
  25. const base = {
  26. taskId: "task-1",
  27. workspacePath: "/workspace/demo",
  28. workspaceIdentity: "ssh://host/workspace/demo",
  29. clientMode: "web-remote-replayable" as const,
  30. messageLimit: 10,
  31. model: "bigmodel-api/GLM-5.2",
  32. };
  33. expect(
  34. buildSnapshotDedupeKey({
  35. ...base,
  36. thoughtLevel: "high",
  37. }),
  38. ).not.toBe(
  39. buildSnapshotDedupeKey({
  40. ...base,
  41. thoughtLevel: "max",
  42. }),
  43. );
  44. });
  45. it("separates replayable snapshots by resume model policy", () => {
  46. const base = {
  47. taskId: "task-1",
  48. workspacePath: "/workspace/demo",
  49. clientMode: "web-remote-replayable" as const,
  50. };
  51. expect(buildSnapshotDedupeKey(base)).not.toBe(
  52. buildSnapshotDedupeKey({
  53. ...base,
  54. resumeModelPolicy: "ui-resolved-only",
  55. }),
  56. );
  57. });
  58. });