fix(agent-switch): add missing session.create mock to hook tests
This commit is contained in:
@@ -21,6 +21,7 @@ describe("agent-switch hook", () => {
|
|||||||
const ctx = {
|
const ctx = {
|
||||||
client: {
|
client: {
|
||||||
session: {
|
session: {
|
||||||
|
create: async () => ({ data: { id: "fresh-ses-1" } }),
|
||||||
promptAsync: async (args: Record<string, unknown>) => {
|
promptAsync: async (args: Record<string, unknown>) => {
|
||||||
promptAsyncCalls.push(args)
|
promptAsyncCalls.push(args)
|
||||||
switched = true
|
switched = true
|
||||||
@@ -51,6 +52,7 @@ describe("agent-switch hook", () => {
|
|||||||
const ctx = {
|
const ctx = {
|
||||||
client: {
|
client: {
|
||||||
session: {
|
session: {
|
||||||
|
create: async () => ({ data: { id: "fresh-ses-2" } }),
|
||||||
promptAsync: async () => {
|
promptAsync: async () => {
|
||||||
throw new Error("temporary failure")
|
throw new Error("temporary failure")
|
||||||
},
|
},
|
||||||
@@ -84,6 +86,7 @@ describe("agent-switch hook", () => {
|
|||||||
const ctx = {
|
const ctx = {
|
||||||
client: {
|
client: {
|
||||||
session: {
|
session: {
|
||||||
|
create: async () => ({ data: { id: "fresh-ses-3" } }),
|
||||||
promptAsync: async () => {
|
promptAsync: async () => {
|
||||||
attempts += 1
|
attempts += 1
|
||||||
if (attempts === 1) {
|
if (attempts === 1) {
|
||||||
@@ -193,6 +196,7 @@ describe("agent-switch hook", () => {
|
|||||||
const ctx = {
|
const ctx = {
|
||||||
client: {
|
client: {
|
||||||
session: {
|
session: {
|
||||||
|
create: async () => ({ data: { id: "fresh-ses-6" } }),
|
||||||
promptAsync: async (args: Record<string, unknown>) => {
|
promptAsync: async (args: Record<string, unknown>) => {
|
||||||
promptAsyncCalls.push(args)
|
promptAsyncCalls.push(args)
|
||||||
switched = true
|
switched = true
|
||||||
@@ -235,6 +239,7 @@ describe("agent-switch hook", () => {
|
|||||||
const ctx = {
|
const ctx = {
|
||||||
client: {
|
client: {
|
||||||
session: {
|
session: {
|
||||||
|
create: async () => ({ data: { id: "fresh-ses-8" } }),
|
||||||
promptAsync: async (args: Record<string, unknown>) => {
|
promptAsync: async (args: Record<string, unknown>) => {
|
||||||
promptAsyncCalls.push(args)
|
promptAsyncCalls.push(args)
|
||||||
switched = true
|
switched = true
|
||||||
@@ -276,6 +281,7 @@ describe("agent-switch hook", () => {
|
|||||||
const ctx = {
|
const ctx = {
|
||||||
client: {
|
client: {
|
||||||
session: {
|
session: {
|
||||||
|
create: async () => ({ data: { id: "fresh-ses-7" } }),
|
||||||
promptAsync: async (args: Record<string, unknown>) => {
|
promptAsync: async (args: Record<string, unknown>) => {
|
||||||
promptAsyncCalls.push(args)
|
promptAsyncCalls.push(args)
|
||||||
switched = true
|
switched = true
|
||||||
@@ -321,6 +327,7 @@ describe("agent-switch hook", () => {
|
|||||||
const ctx = {
|
const ctx = {
|
||||||
client: {
|
client: {
|
||||||
session: {
|
session: {
|
||||||
|
create: async () => ({ data: { id: "fresh-ses-9" } }),
|
||||||
promptAsync: async (args: Record<string, unknown>) => {
|
promptAsync: async (args: Record<string, unknown>) => {
|
||||||
promptAsyncCalls.push(args)
|
promptAsyncCalls.push(args)
|
||||||
switched = true
|
switched = true
|
||||||
|
|||||||
Reference in New Issue
Block a user