File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -502,3 +502,45 @@ func TestConvertToBase64PatchedServers(t *testing.T) {
502502 })
503503 }
504504}
505+
506+ func TestBase64Bytes_MarshalYAML (t * testing.T ) {
507+ tests := []struct {
508+ name string
509+ input Base64Bytes
510+ expected interface {}
511+ }{
512+ {
513+ name : "empty bytes" ,
514+ input : Base64Bytes {},
515+ expected : "" ,
516+ },
517+ {
518+ name : "nil bytes" ,
519+ input : Base64Bytes (nil ),
520+ expected : "" ,
521+ },
522+ {
523+ name : "simple text" ,
524+ input : Base64Bytes ("test" ),
525+ expected : "dGVzdA==" ,
526+ },
527+ {
528+ name : "special characters" ,
529+ input : Base64Bytes ("test@#$%" ),
530+ expected : "dGVzdEAjJCU=" ,
531+ },
532+ }
533+
534+ for _ , tt := range tests {
535+ t .Run (tt .name , func (t * testing.T ) {
536+ result , err := tt .input .MarshalYAML ()
537+ if err != nil {
538+ t .Errorf ("MarshalYAML() error = %v" , err )
539+ return
540+ }
541+ if result != tt .expected {
542+ t .Errorf ("MarshalYAML() = %v, want %v" , result , tt .expected )
543+ }
544+ })
545+ }
546+ }
You can’t perform that action at this time.
0 commit comments