@@ -539,3 +539,53 @@ where
539539
540540 serde_yaml:: from_str ( & index_file_content) . context ( DeserializeYamlSnafu )
541541}
542+
543+ #[ cfg( test) ]
544+ mod tests {
545+ use super :: * ;
546+
547+ #[ test]
548+ fn source_kind_oci ( ) {
549+ let repo = ChartRepo {
550+ name : "nifi-operator" . to_string ( ) ,
551+ url : "oci://oci.stackable.tech/sdp-charts" . to_string ( ) ,
552+ } ;
553+ assert_eq ! ( repo. source_kind( ) , ChartSourceKind :: Oci ) ;
554+ }
555+
556+ #[ test]
557+ fn source_kind_https_repo ( ) {
558+ let repo = ChartRepo {
559+ name : "stackable-stable" . to_string ( ) ,
560+ url : "https://repo.stackable.tech/repository/helm-stable" . to_string ( ) ,
561+ } ;
562+ assert_eq ! ( repo. source_kind( ) , ChartSourceKind :: Repo ) ;
563+ }
564+
565+ #[ test]
566+ fn source_kind_http_repo ( ) {
567+ let repo = ChartRepo {
568+ name : "example" . to_string ( ) ,
569+ url : "http://example.com/charts" . to_string ( ) ,
570+ } ;
571+ assert_eq ! ( repo. source_kind( ) , ChartSourceKind :: Repo ) ;
572+ }
573+
574+ #[ test]
575+ fn source_kind_relative_path_is_local ( ) {
576+ let repo = ChartRepo {
577+ name : "local" . to_string ( ) ,
578+ url : "./charts/my-chart" . to_string ( ) ,
579+ } ;
580+ assert_eq ! ( repo. source_kind( ) , ChartSourceKind :: Local ) ;
581+ }
582+
583+ #[ test]
584+ fn source_kind_absolute_path_is_local ( ) {
585+ let repo = ChartRepo {
586+ name : "local" . to_string ( ) ,
587+ url : "/absolute/path/to/chart" . to_string ( ) ,
588+ } ;
589+ assert_eq ! ( repo. source_kind( ) , ChartSourceKind :: Local ) ;
590+ }
591+ }
0 commit comments