@@ -3110,15 +3110,21 @@ describe("docker_stackConfig input validation", () => {
31103110describe ( "docker_configCreate input validation" , ( ) => {
31113111 const schema = z . object ( {
31123112 name : z . string ( ) . min ( 1 ) ,
3113- file : z . string ( ) . min ( 1 ) ,
3113+ file : z . string ( ) . optional ( ) ,
3114+ data : z . string ( ) . optional ( ) ,
31143115 labels : z . array ( z . string ( ) ) . optional ( ) ,
31153116 } ) ;
31163117
3117- it ( "accepts required fields " , ( ) => {
3118+ it ( "accepts with file " , ( ) => {
31183119 const result = schema . parse ( { name : "my-config" , file : "/path/to/config" } ) ;
31193120 expect ( result . name ) . toBe ( "my-config" ) ;
31203121 } ) ;
31213122
3123+ it ( "accepts with inline data" , ( ) => {
3124+ const result = schema . parse ( { name : "my-config" , data : "key=value" } ) ;
3125+ expect ( result . data ) . toBe ( "key=value" ) ;
3126+ } ) ;
3127+
31223128 it ( "accepts with labels" , ( ) => {
31233129 const result = schema . parse ( { name : "cfg" , file : "f" , labels : [ "env=prod" ] } ) ;
31243130 expect ( result . labels ) . toEqual ( [ "env=prod" ] ) ;
@@ -3182,22 +3188,28 @@ describe("docker_configRm input validation", () => {
31823188describe ( "docker_secretCreate input validation" , ( ) => {
31833189 const schema = z . object ( {
31843190 name : z . string ( ) . min ( 1 ) ,
3185- file : z . string ( ) . min ( 1 ) ,
3191+ file : z . string ( ) . optional ( ) ,
3192+ data : z . string ( ) . optional ( ) ,
31863193 labels : z . array ( z . string ( ) ) . optional ( ) ,
31873194 } ) ;
31883195
3189- it ( "accepts required fields " , ( ) => {
3196+ it ( "accepts with file " , ( ) => {
31903197 const result = schema . parse ( { name : "my-secret" , file : "/path/to/secret" } ) ;
31913198 expect ( result . name ) . toBe ( "my-secret" ) ;
31923199 } ) ;
31933200
3201+ it ( "accepts with inline data" , ( ) => {
3202+ const result = schema . parse ( { name : "my-secret" , data : "s3cret" } ) ;
3203+ expect ( result . data ) . toBe ( "s3cret" ) ;
3204+ } ) ;
3205+
31943206 it ( "accepts with labels" , ( ) => {
31953207 const result = schema . parse ( { name : "sec" , file : "f" , labels : [ "env=prod" ] } ) ;
31963208 expect ( result . labels ) . toEqual ( [ "env=prod" ] ) ;
31973209 } ) ;
31983210
31993211 it ( "rejects empty name" , ( ) => {
3200- expect ( ( ) => schema . parse ( { name : "" , file : "f " } ) ) . toThrow ( ) ;
3212+ expect ( ( ) => schema . parse ( { name : "" , data : "x " } ) ) . toThrow ( ) ;
32013213 } ) ;
32023214} ) ;
32033215
0 commit comments