@@ -36,15 +36,12 @@ func TestReadRootSidekick(t *testing.T) {
3636 name : "success" ,
3737 path : "testdata/root-sidekick/success" ,
3838 want : & config.Config {
39- Language : "rust" ,
39+ Language : "dart" ,
40+ Version : "0.4.0" ,
4041 Sources : & config.Sources {
41- Discovery : & config.Source {
42- Commit : "0bb1100f52bf0bae06f4b4d76742e7eba5c59793" ,
43- SHA256 : "67c8d3792f0ebf5f0582dce675c379d0f486604eb0143814c79e788954aa1212" ,
44- },
4542 Googleapis : & config.Source {
46- Commit : "fe58211356a91f4140ed51893703910db05ade91 " ,
47- SHA256 : "839e897c39cada559b97d64f90378715a4a43fbc972d8cf93296db4156662085 " ,
43+ Commit : "211d22fa6dfabfa52cbda04d1aee852a01301edf " ,
44+ SHA256 : "9aa6e5167f76b869b53b71f9fe963e6e17ec58b2cbdeb30715ef95b92faabfc5 " ,
4845 },
4946 Showcase : & config.Source {
5047 Commit : "69bdd62035d793f3d23a0c960dee547023c1c5ac" ,
@@ -61,36 +58,37 @@ func TestReadRootSidekick(t *testing.T) {
6158 },
6259 },
6360 Default : & config.Default {
64- Output : "src/generated/" ,
65- ReleaseLevel : "stable" ,
66- Rust : & config.RustDefault {
67- DisabledRustdocWarnings : []string {
68- "redundant_explicit_links" ,
69- "broken_intra_doc_links" ,
61+ Output : "generated/" ,
62+ ReleaseLevel : "" ,
63+ Dart : & config.DartPackage {
64+ APIKeysEnvironmentVariables : "GOOGLE_API_KEY" ,
65+ IssueTrackerURL : "https://github.com/googleapis/google-cloud-dart/issues" ,
66+ Packages : map [string ]string {
67+ "package:google_cloud_api" : "^0.4.0" ,
68+ "package:google_cloud_iam_v1" : "^0.4.0" ,
69+ "package:google_cloud_location" : "^0.4.0" ,
70+ "package:google_cloud_logging_type" : "^0.4.0" ,
71+ "package:google_cloud_longrunning" : "^0.4.0" ,
72+ "package:google_cloud_protobuf" : "^0.4.0" ,
73+ "package:google_cloud_rpc" : "^0.4.0" ,
74+ "package:google_cloud_type" : "^0.4.0" ,
75+ "package:googleapis_auth" : "^2.0.0" ,
76+ "package:http" : "^1.3.0" ,
7077 },
71- PackageDependencies : []* config.RustPackageDependency {
72- {
73- Feature : "_internal-http-client" ,
74- Name : "gaxi" ,
75- Package : "google-cloud-gax-internal" ,
76- Source : "internal" ,
77- UsedIf : "services" ,
78- },
79- {
80- Name : "lazy_static" ,
81- Package : "lazy_static" ,
82- UsedIf : "services" ,
83- ForceUsed : true ,
84- },
78+ Prefixes : map [string ]string {"prefix:google.logging.type" : "logging_type" },
79+ Protos : map [string ]string {
80+ "proto:google.api" : "package:google_cloud_api/api.dart" ,
81+ "proto:google.cloud.common" : "package:google_cloud_common/common.dart" ,
82+ "proto:google.cloud.location" : "package:google_cloud_location/location.dart" ,
83+ "proto:google.iam.v1" : "package:google_cloud_iam_v1/iam.dart" ,
84+ "proto:google.logging.type" : "package:google_cloud_logging_type/logging_type.dart" ,
85+ "proto:google.longrunning" : "package:google_cloud_longrunning/longrunning.dart" ,
86+ "proto:google.protobuf" : "package:google_cloud_protobuf/protobuf.dart" ,
87+ "proto:google.rpc" : "package:google_cloud_rpc/rpc.dart" ,
88+ "proto:google.type" : "package:google_cloud_type/type.dart" ,
8589 },
86- GenerateSetterSamples : "true" ,
8790 },
8891 },
89- Release : & config.Release {
90- Remote : "upstream" ,
91- Branch : "main" ,
92- IgnoredChanges : []string {".repo-metadata.json" , ".sidekick.toml" },
93- },
9492 },
9593 },
9694 {
@@ -890,29 +888,41 @@ func TestRunMigrateCommand(t *testing.T) {
890888 }
891889}
892890
893- func TestParseDartPackages (t * testing.T ) {
894- t .Parallel ()
891+ func TestParseWithPrefix (t * testing.T ) {
895892 for _ , test := range []struct {
896- name string
897- codec map [ string ] string
898- want map [string ]string
893+ name string
894+ prefix string
895+ want map [string ]string
899896 }{
900897 {
901- name : "success" ,
902- codec : map [string ]string {
898+ name : "prefix: as a prefix" ,
899+ prefix : "prefix:" ,
900+ want : map [string ]string {
903901 "prefix:google.logging.type" : "logging_type" ,
904- "package:googleapis_auth" : "^2.0.0" ,
905- "package:http" : "^1.3.0" ,
906902 },
903+ },
904+ {
905+ name : "package: as a prefix" ,
906+ prefix : "package:" ,
907907 want : map [string ]string {
908908 "package:googleapis_auth" : "^2.0.0" ,
909- "package:http" : "^1.3.0" ,
909+ },
910+ },
911+ {
912+ name : "proto: as a prefix" ,
913+ prefix : "proto:" ,
914+ want : map [string ]string {
915+ "proto:google.protobuf" : "package:google_cloud_protobuf/protobuf.dart" ,
910916 },
911917 },
912918 } {
913919 t .Run (test .name , func (t * testing.T ) {
914- t .Parallel ()
915- got := parseDartPackages (test .codec )
920+ codec := map [string ]string {
921+ "prefix:google.logging.type" : "logging_type" ,
922+ "package:googleapis_auth" : "^2.0.0" ,
923+ "proto:google.protobuf" : "package:google_cloud_protobuf/protobuf.dart" ,
924+ }
925+ got := parseKeyWithPrefix (codec , test .prefix )
916926 if diff := cmp .Diff (test .want , got ); diff != "" {
917927 t .Errorf ("mismatch (-want +got):\n %s" , diff )
918928 }
0 commit comments