@@ -2,6 +2,7 @@ import { describe, expect, it } from "bun:test"
22import { homedir } from "node:os"
33import { join } from "node:path"
44import {
5+ AGENT_NAMES ,
56 AGENTS_TARGET_DIR ,
67 checkVersionCompatibility ,
78 createLogger ,
@@ -381,6 +382,41 @@ describe("paths.mjs exports", () => {
381382 } )
382383
383384 describe ( "constants" , ( ) => {
385+ it ( "should export AGENT_NAMES as an array" , ( ) => {
386+ expect ( Array . isArray ( AGENT_NAMES ) ) . toBe ( true )
387+ expect ( AGENT_NAMES ) . toContain ( "opencoder" )
388+ expect ( AGENT_NAMES ) . toContain ( "opencoder-planner" )
389+ expect ( AGENT_NAMES ) . toContain ( "opencoder-builder" )
390+ } )
391+
392+ it ( "should have AGENT_NAMES frozen (immutable)" , ( ) => {
393+ expect ( Object . isFrozen ( AGENT_NAMES ) ) . toBe ( true )
394+ } )
395+
396+ it ( "should prevent push to AGENT_NAMES" , ( ) => {
397+ const originalLength = AGENT_NAMES . length
398+ expect ( ( ) => {
399+ ; ( AGENT_NAMES as string [ ] ) . push ( "new-agent" )
400+ } ) . toThrow ( )
401+ expect ( AGENT_NAMES . length ) . toBe ( originalLength )
402+ } )
403+
404+ it ( "should prevent modification of AGENT_NAMES elements" , ( ) => {
405+ const originalFirst = AGENT_NAMES [ 0 ]
406+ expect ( ( ) => {
407+ ; ( AGENT_NAMES as string [ ] ) [ 0 ] = "modified"
408+ } ) . toThrow ( )
409+ expect ( AGENT_NAMES [ 0 ] ) . toBe ( originalFirst )
410+ } )
411+
412+ it ( "should prevent pop from AGENT_NAMES" , ( ) => {
413+ const originalLength = AGENT_NAMES . length
414+ expect ( ( ) => {
415+ ; ( AGENT_NAMES as string [ ] ) . pop ( )
416+ } ) . toThrow ( )
417+ expect ( AGENT_NAMES . length ) . toBe ( originalLength )
418+ } )
419+
384420 it ( "should export MIN_CONTENT_LENGTH as a number" , ( ) => {
385421 expect ( typeof MIN_CONTENT_LENGTH ) . toBe ( "number" )
386422 expect ( MIN_CONTENT_LENGTH ) . toBe ( 100 )
0 commit comments