@@ -442,6 +442,51 @@ func TestConvertToModel(t *testing.T) {
442442				},
443443			},
444444		},
445+ 		{
446+ 			name :      "Error/InvalidReleaseVersion" ,
447+ 			assertion : hasError (`error parsing bundle "foo.v0.1.0" release version "!!!": Invalid character(s) found in prerelease "!!!"` ),
448+ 			cfg : DeclarativeConfig {
449+ 				Packages : []Package {newTestPackage ("foo" , "alpha" , svgSmallCircle )},
450+ 				Channels : []Channel {newTestChannel ("foo" , "alpha" , ChannelEntry {Name : testBundleName ("foo" , "0.1.0" )})},
451+ 				Bundles : []Bundle {newTestBundle ("foo" , "0.1.0" , func (b  * Bundle ) {
452+ 					b .Properties  =  []property.Property {
453+ 						property .MustBuildPackageRelease ("foo" , "0.1.0" , "!!!" ),
454+ 					}
455+ 				})},
456+ 			},
457+ 		},
458+ 		{
459+ 			name : "Error/InvalidBundleNormalizedName" ,
460+ 			assertion : hasError (`invalid index: 
461+ └── invalid package "foo": 
462+     └── invalid channel "alpha": 
463+         └── invalid bundle "foo.v0.1.0-alpha.1.0.0": 
464+             └── name "foo.v0.1.0-alpha.1.0.0" does not match normalized name "foo-v0.1.0-alpha.1.0.0"` ),
465+ 			cfg : DeclarativeConfig {
466+ 				Packages : []Package {newTestPackage ("foo" , "alpha" , svgSmallCircle )},
467+ 				Channels : []Channel {newTestChannel ("foo" , "alpha" , ChannelEntry {Name : "foo.v0.1.0-alpha.1.0.0" })},
468+ 				Bundles : []Bundle {newTestBundle ("foo" , "0.1.0" , func (b  * Bundle ) {
469+ 					b .Properties  =  []property.Property {
470+ 						property .MustBuildPackageRelease ("foo" , "0.1.0" , "alpha.1.0.0" ),
471+ 					}
472+ 					b .Name  =  "foo.v0.1.0-alpha.1.0.0" 
473+ 				})},
474+ 			},
475+ 		},
476+ 		{
477+ 			name :      "Success/ValidBundleReleaseVersion" ,
478+ 			assertion : require .NoError ,
479+ 			cfg : DeclarativeConfig {
480+ 				Packages : []Package {newTestPackage ("foo" , "alpha" , svgSmallCircle )},
481+ 				Channels : []Channel {newTestChannel ("foo" , "alpha" , ChannelEntry {Name : "foo-v0.1.0-alpha.1.0.0" })},
482+ 				Bundles : []Bundle {newTestBundle ("foo" , "0.1.0" , func (b  * Bundle ) {
483+ 					b .Properties  =  []property.Property {
484+ 						property .MustBuildPackageRelease ("foo" , "0.1.0" , "alpha.1.0.0" ),
485+ 					}
486+ 					b .Name  =  "foo-v0.1.0-alpha.1.0.0" 
487+ 				})},
488+ 			},
489+ 		},
445490	}
446491
447492	for  _ , s  :=  range  specs  {
0 commit comments