|
|
@@ -4,9 +4,11 @@ import {
|
|
|
organizationCloudSettingsSchema,
|
|
|
organizationFeaturesSchema,
|
|
|
organizationSettingsSchema,
|
|
|
+ userSettingsConfigSchema,
|
|
|
type OrganizationCloudSettings,
|
|
|
type OrganizationFeatures,
|
|
|
type OrganizationSettings,
|
|
|
+ type UserSettingsConfig,
|
|
|
type WorkspaceTaskVisibility,
|
|
|
} from "../cloud.js"
|
|
|
|
|
|
@@ -407,3 +409,75 @@ describe("organizationCloudSettingsSchema with llmEnhancedFeaturesEnabled", () =
|
|
|
expect(result.data?.cloudSettings?.llmEnhancedFeaturesEnabled).toBe(false)
|
|
|
})
|
|
|
})
|
|
|
+
|
|
|
+describe("userSettingsConfigSchema with llmEnhancedFeaturesEnabled", () => {
|
|
|
+ it("should validate without llmEnhancedFeaturesEnabled property", () => {
|
|
|
+ const input = {
|
|
|
+ extensionBridgeEnabled: true,
|
|
|
+ taskSyncEnabled: true,
|
|
|
+ }
|
|
|
+ const result = userSettingsConfigSchema.safeParse(input)
|
|
|
+ expect(result.success).toBe(true)
|
|
|
+ expect(result.data?.llmEnhancedFeaturesEnabled).toBeUndefined()
|
|
|
+ })
|
|
|
+
|
|
|
+ it("should validate with llmEnhancedFeaturesEnabled as true", () => {
|
|
|
+ const input = {
|
|
|
+ extensionBridgeEnabled: true,
|
|
|
+ taskSyncEnabled: true,
|
|
|
+ llmEnhancedFeaturesEnabled: true,
|
|
|
+ }
|
|
|
+ const result = userSettingsConfigSchema.safeParse(input)
|
|
|
+ expect(result.success).toBe(true)
|
|
|
+ expect(result.data?.llmEnhancedFeaturesEnabled).toBe(true)
|
|
|
+ })
|
|
|
+
|
|
|
+ it("should validate with llmEnhancedFeaturesEnabled as false", () => {
|
|
|
+ const input = {
|
|
|
+ extensionBridgeEnabled: true,
|
|
|
+ taskSyncEnabled: true,
|
|
|
+ llmEnhancedFeaturesEnabled: false,
|
|
|
+ }
|
|
|
+ const result = userSettingsConfigSchema.safeParse(input)
|
|
|
+ expect(result.success).toBe(true)
|
|
|
+ expect(result.data?.llmEnhancedFeaturesEnabled).toBe(false)
|
|
|
+ })
|
|
|
+
|
|
|
+ it("should reject non-boolean llmEnhancedFeaturesEnabled", () => {
|
|
|
+ const input = {
|
|
|
+ llmEnhancedFeaturesEnabled: "true",
|
|
|
+ }
|
|
|
+ const result = userSettingsConfigSchema.safeParse(input)
|
|
|
+ expect(result.success).toBe(false)
|
|
|
+ })
|
|
|
+
|
|
|
+ it("should have correct TypeScript type", () => {
|
|
|
+ // Type-only test to ensure TypeScript compilation
|
|
|
+ const settings: UserSettingsConfig = {
|
|
|
+ extensionBridgeEnabled: true,
|
|
|
+ taskSyncEnabled: true,
|
|
|
+ llmEnhancedFeaturesEnabled: true,
|
|
|
+ }
|
|
|
+ expect(settings.llmEnhancedFeaturesEnabled).toBe(true)
|
|
|
+
|
|
|
+ const settingsWithoutLlmFeatures: UserSettingsConfig = {
|
|
|
+ extensionBridgeEnabled: false,
|
|
|
+ }
|
|
|
+ expect(settingsWithoutLlmFeatures.llmEnhancedFeaturesEnabled).toBeUndefined()
|
|
|
+ })
|
|
|
+
|
|
|
+ it("should validate empty object", () => {
|
|
|
+ const result = userSettingsConfigSchema.safeParse({})
|
|
|
+ expect(result.success).toBe(true)
|
|
|
+ expect(result.data).toEqual({})
|
|
|
+ })
|
|
|
+
|
|
|
+ it("should validate with only llmEnhancedFeaturesEnabled", () => {
|
|
|
+ const input = {
|
|
|
+ llmEnhancedFeaturesEnabled: true,
|
|
|
+ }
|
|
|
+ const result = userSettingsConfigSchema.safeParse(input)
|
|
|
+ expect(result.success).toBe(true)
|
|
|
+ expect(result.data?.llmEnhancedFeaturesEnabled).toBe(true)
|
|
|
+ })
|
|
|
+})
|