fix(sisyphus-task): guard client.session.get and update sync mode tests

- Add guard clause to check if client.session.get exists before calling
- Update 4 sync mode tests to properly mock session.get
- Fixes test failures from PR #731 directory inheritance feature
This commit is contained in:
Kenny
2026-01-13 13:41:41 -05:00
parent 31c5951dfc
commit 444b7ce991
2 changed files with 7 additions and 3 deletions
+4
View File
@@ -452,6 +452,7 @@ describe("sisyphus-task", () => {
const mockClient = {
session: {
get: async () => ({ data: { directory: "/project" } }),
create: async () => ({ data: { id: "ses_sync_error_test" } }),
prompt: async () => {
throw new Error("JSON Parse error: Unexpected EOF")
@@ -504,6 +505,7 @@ describe("sisyphus-task", () => {
const mockClient = {
session: {
get: async () => ({ data: { directory: "/project" } }),
create: async () => ({ data: { id: "ses_sync_success" } }),
prompt: async () => ({ data: {} }),
messages: async () => ({
@@ -560,6 +562,7 @@ describe("sisyphus-task", () => {
const mockClient = {
session: {
get: async () => ({ data: { directory: "/project" } }),
create: async () => ({ data: { id: "ses_agent_notfound" } }),
prompt: async () => {
throw new Error("Cannot read property 'name' of undefined agent.name")
@@ -610,6 +613,7 @@ describe("sisyphus-task", () => {
const mockManager = { launch: async () => ({}) }
const mockClient = {
session: {
get: async () => ({ data: { directory: "/project" } }),
create: async () => ({ data: { id: "ses_sync_model" } }),
prompt: async (input: any) => {
promptBody = input.body