Skip to content

Commit

Permalink
Change typo
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaspoignant committed Oct 24, 2024
1 parent 18f2563 commit ba8abd6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
18 changes: 9 additions & 9 deletions internal/flag/internal_flag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1993,7 +1993,7 @@ func TestInternalFlag_GetVariationValue(t *testing.T) {
want interface{}
}{
{
name: "Should return nil if variation does not exists",
name: "Should return nil if variation does not exist",
flag: flag.InternalFlag{
Variations: &map[string]*interface{}{
"varA": testconvert.Interface("valueA"),
Expand Down Expand Up @@ -2379,7 +2379,7 @@ func TestInternalFlag_IsValid(t *testing.T) {
VariationResult: testconvert.String("C"),
},
},
errorMsg: "invalid variation: C does not exists",
errorMsg: "invalid variation: C does not exist",
wantErr: assert.Error,
},
{
Expand All @@ -2397,7 +2397,7 @@ func TestInternalFlag_IsValid(t *testing.T) {
},
},
},
errorMsg: "invalid percentage: variation C does not exists",
errorMsg: "invalid percentage: variation C does not exist",
wantErr: assert.Error,
},
{
Expand All @@ -2422,7 +2422,7 @@ func TestInternalFlag_IsValid(t *testing.T) {
},
},
},
errorMsg: "invalid progressive rollout, end variation C does not exists",
errorMsg: "invalid progressive rollout, end variation C does not exist",
wantErr: assert.Error,
},
{
Expand All @@ -2447,7 +2447,7 @@ func TestInternalFlag_IsValid(t *testing.T) {
},
},
},
errorMsg: "invalid progressive rollout, initial variation C does not exists",
errorMsg: "invalid progressive rollout, initial variation C does not exist",
wantErr: assert.Error,
},
{
Expand All @@ -2467,7 +2467,7 @@ func TestInternalFlag_IsValid(t *testing.T) {
VariationResult: testconvert.String("A"),
},
},
errorMsg: "invalid variation: C does not exists",
errorMsg: "invalid variation: C does not exist",
wantErr: assert.Error,
},
{
Expand All @@ -2491,7 +2491,7 @@ func TestInternalFlag_IsValid(t *testing.T) {
VariationResult: testconvert.String("A"),
},
},
errorMsg: "invalid percentage: variation C does not exists",
errorMsg: "invalid percentage: variation C does not exist",
wantErr: assert.Error,
},
{
Expand Down Expand Up @@ -2522,7 +2522,7 @@ func TestInternalFlag_IsValid(t *testing.T) {
VariationResult: testconvert.String("A"),
},
},
errorMsg: "invalid progressive rollout, initial variation C does not exists",
errorMsg: "invalid progressive rollout, initial variation C does not exist",
wantErr: assert.Error,
},
{
Expand Down Expand Up @@ -2553,7 +2553,7 @@ func TestInternalFlag_IsValid(t *testing.T) {
VariationResult: testconvert.String("A"),
},
},
errorMsg: "invalid progressive rollout, end variation C does not exists",
errorMsg: "invalid progressive rollout, end variation C does not exist",
wantErr: assert.Error,
},
}
Expand Down
8 changes: 4 additions & 4 deletions internal/flag/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func (r *Rule) IsValid(defaultRule bool, variations map[string]*interface{}) err
for k, p := range r.GetPercentages() {
count += p
if _, ok := variations[k]; !ok {
return fmt.Errorf("invalid percentage: variation %s does not exists", k)
return fmt.Errorf("invalid percentage: variation %s does not exist", k)
}
}

Expand All @@ -266,19 +266,19 @@ func (r *Rule) IsValid(defaultRule bool, variations map[string]*interface{}) err

endVar := r.GetProgressiveRollout().End.getVariation()
if _, ok := variations[endVar]; !ok {
return fmt.Errorf("invalid progressive rollout, end variation %s does not exists", endVar)
return fmt.Errorf("invalid progressive rollout, end variation %s does not exist", endVar)
}

initialVar := r.GetProgressiveRollout().Initial.getVariation()
if _, ok := variations[initialVar]; !ok {
return fmt.Errorf("invalid progressive rollout, initial variation %s does not exists", initialVar)
return fmt.Errorf("invalid progressive rollout, initial variation %s does not exist", initialVar)
}
}

// Check that the variation exists
if r.Percentages == nil && r.ProgressiveRollout == nil && r.VariationResult != nil {
if _, ok := variations[r.GetVariationResult()]; !ok {
return fmt.Errorf("invalid variation: %s does not exists", r.GetVariationResult())
return fmt.Errorf("invalid variation: %s does not exist", r.GetVariationResult())
}
}
return nil
Expand Down

0 comments on commit ba8abd6

Please sign in to comment.