@@ -2213,19 +2213,22 @@ describe("OPENCODE_CONFIG_CONTENT token substitution", () => {
22132213// parseManagedPlist unit tests — pure function, no OS interaction
22142214
22152215test ( "parseManagedPlist strips MDM metadata keys" , async ( ) => {
2216- const config = ConfigParse . parse (
2216+ const config = ConfigParse . schema (
22172217 Config . Info ,
2218- await ConfigManaged . parseManagedPlist (
2219- JSON . stringify ( {
2220- PayloadDisplayName : "OpenCode Managed" ,
2221- PayloadIdentifier : "ai.opencode.managed.test" ,
2222- PayloadType : "ai.opencode.managed" ,
2223- PayloadUUID : "AAAA-BBBB-CCCC" ,
2224- PayloadVersion : 1 ,
2225- _manualProfile : true ,
2226- share : "disabled" ,
2227- model : "mdm/model" ,
2228- } ) ,
2218+ ConfigParse . jsonc (
2219+ await ConfigManaged . parseManagedPlist (
2220+ JSON . stringify ( {
2221+ PayloadDisplayName : "OpenCode Managed" ,
2222+ PayloadIdentifier : "ai.opencode.managed.test" ,
2223+ PayloadType : "ai.opencode.managed" ,
2224+ PayloadUUID : "AAAA-BBBB-CCCC" ,
2225+ PayloadVersion : 1 ,
2226+ _manualProfile : true ,
2227+ share : "disabled" ,
2228+ model : "mdm/model" ,
2229+ } ) ,
2230+ ) ,
2231+ "test:mobileconfig" ,
22292232 ) ,
22302233 "test:mobileconfig" ,
22312234 )
@@ -2238,14 +2241,17 @@ test("parseManagedPlist strips MDM metadata keys", async () => {
22382241} )
22392242
22402243test ( "parseManagedPlist parses server settings" , async ( ) => {
2241- const config = ConfigParse . parse (
2244+ const config = ConfigParse . schema (
22422245 Config . Info ,
2243- await ConfigManaged . parseManagedPlist (
2244- JSON . stringify ( {
2245- $schema : "https://opencode.ai/config.json" ,
2246- server : { hostname : "127.0.0.1" , mdns : false } ,
2247- autoupdate : true ,
2248- } ) ,
2246+ ConfigParse . jsonc (
2247+ await ConfigManaged . parseManagedPlist (
2248+ JSON . stringify ( {
2249+ $schema : "https://opencode.ai/config.json" ,
2250+ server : { hostname : "127.0.0.1" , mdns : false } ,
2251+ autoupdate : true ,
2252+ } ) ,
2253+ ) ,
2254+ "test:mobileconfig" ,
22492255 ) ,
22502256 "test:mobileconfig" ,
22512257 )
@@ -2255,20 +2261,23 @@ test("parseManagedPlist parses server settings", async () => {
22552261} )
22562262
22572263test ( "parseManagedPlist parses permission rules" , async ( ) => {
2258- const config = ConfigParse . parse (
2264+ const config = ConfigParse . schema (
22592265 Config . Info ,
2260- await ConfigManaged . parseManagedPlist (
2261- JSON . stringify ( {
2262- $schema : "https://opencode.ai/config.json" ,
2263- permission : {
2264- "*" : "ask" ,
2265- bash : { "*" : "ask" , "rm -rf *" : "deny" , "curl *" : "deny" } ,
2266- grep : "allow" ,
2267- glob : "allow" ,
2268- webfetch : "ask" ,
2269- "~/.ssh/*" : "deny" ,
2270- } ,
2271- } ) ,
2266+ ConfigParse . jsonc (
2267+ await ConfigManaged . parseManagedPlist (
2268+ JSON . stringify ( {
2269+ $schema : "https://opencode.ai/config.json" ,
2270+ permission : {
2271+ "*" : "ask" ,
2272+ bash : { "*" : "ask" , "rm -rf *" : "deny" , "curl *" : "deny" } ,
2273+ grep : "allow" ,
2274+ glob : "allow" ,
2275+ webfetch : "ask" ,
2276+ "~/.ssh/*" : "deny" ,
2277+ } ,
2278+ } ) ,
2279+ ) ,
2280+ "test:mobileconfig" ,
22722281 ) ,
22732282 "test:mobileconfig" ,
22742283 )
@@ -2282,23 +2291,29 @@ test("parseManagedPlist parses permission rules", async () => {
22822291} )
22832292
22842293test ( "parseManagedPlist parses enabled_providers" , async ( ) => {
2285- const config = ConfigParse . parse (
2294+ const config = ConfigParse . schema (
22862295 Config . Info ,
2287- await ConfigManaged . parseManagedPlist (
2288- JSON . stringify ( {
2289- $schema : "https://opencode.ai/config.json" ,
2290- enabled_providers : [ "anthropic" , "google" ] ,
2291- } ) ,
2296+ ConfigParse . jsonc (
2297+ await ConfigManaged . parseManagedPlist (
2298+ JSON . stringify ( {
2299+ $schema : "https://opencode.ai/config.json" ,
2300+ enabled_providers : [ "anthropic" , "google" ] ,
2301+ } ) ,
2302+ ) ,
2303+ "test:mobileconfig" ,
22922304 ) ,
22932305 "test:mobileconfig" ,
22942306 )
22952307 expect ( config . enabled_providers ) . toEqual ( [ "anthropic" , "google" ] )
22962308} )
22972309
22982310test ( "parseManagedPlist handles empty config" , async ( ) => {
2299- const config = ConfigParse . parse (
2311+ const config = ConfigParse . schema (
23002312 Config . Info ,
2301- await ConfigManaged . parseManagedPlist ( JSON . stringify ( { $schema : "https://opencode.ai/config.json" } ) ) ,
2313+ ConfigParse . jsonc (
2314+ await ConfigManaged . parseManagedPlist ( JSON . stringify ( { $schema : "https://opencode.ai/config.json" } ) ) ,
2315+ "test:mobileconfig" ,
2316+ ) ,
23022317 "test:mobileconfig" ,
23032318 )
23042319 expect ( config . $schema ) . toBe ( "https://opencode.ai/config.json" )
0 commit comments