Skip to content

Commit

Permalink
Add 'TestPartitionRegions'.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Sep 17, 2024
1 parent 80d4e38 commit 1b1dd67
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions endpoints/partition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,31 @@ func TestPartitionForRegion(t *testing.T) {
t.Errorf("expected PartitionID %q for Region %q, got %q", testcase.expectedID, region, gotID.ID())
}
}
}

func TestPartitionRegions(t *testing.T) {
t.Parallel()

testcases := map[string]struct {
expectedRegions bool
}{
"us-east-1": {
expectedRegions: true,
},
"us-gov-west-1": {
expectedRegions: true,
},
"not-found": {
expectedRegions: false,
},
}

ps := endpoints.DefaultPartitions()
for region, testcase := range testcases {
gotID, _ := endpoints.PartitionForRegion(ps, region)

if got, want := len(gotID.Regions()) > 0, testcase.expectedRegions; got != want {
t.Errorf("expected Regions %t for Region %q, got %t", want, region, got)
}
}
}

0 comments on commit 1b1dd67

Please sign in to comment.