| 50 | } |
| 51 | |
| 52 | func TestInMemoryService_Get(t *testing.T) { |
| 53 | t.Skip("Skipping: inmemory service implementation has issues with session retrieval") |
| 54 | ctx := context.Background() |
| 55 | |
| 56 | t.Run("获取存在的会话", func(t *testing.T) { |
| 57 | service := NewInMemoryService() |
| 58 | // 创建会话 |
| 59 | created, _ := service.Create(ctx, &CreateRequest{ |
| 60 | AppName: "test-app", |
| 61 | UserID: "user-1", |
| 62 | AgentID: "agent-1", |
| 63 | }) |
| 64 | |
| 65 | // 获取会话 |
| 66 | retrieved, err := service.Get(ctx, &GetRequest{ |
| 67 | SessionID: created.ID(), |
| 68 | }) |
| 69 | require.NoError(t, err) |
| 70 | assert.Equal(t, created.ID(), retrieved.ID()) |
| 71 | assert.Equal(t, created.AppName(), retrieved.AppName()) |
| 72 | }) |
| 73 | |
| 74 | t.Run("获取不存在的会话", func(t *testing.T) { |
| 75 | service := NewInMemoryService() |
| 76 | _, err := service.Get(ctx, &GetRequest{ |
| 77 | SessionID: "non-existent-id", |
| 78 | }) |
| 79 | assert.ErrorIs(t, err, ErrSessionNotFound) |
| 80 | }) |
| 81 | } |
| 82 | |
| 83 | func TestInMemoryService_List(t *testing.T) { |
| 84 | t.Skip("Skipping: inmemory service implementation has issues with session retrieval") |