Skip to content

Commit

Permalink
Merge pull request #6125 from q384566678/proxy
Browse files Browse the repository at this point in the history
add unit test for CalculateSizeInMB
  • Loading branch information
medyagh authored Dec 19, 2019
2 parents cf50577 + d864ac3 commit 56c72e2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pkg/util/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,22 @@ func TestConcatStrings(t *testing.T) {
}
}
}

func TestCalculateSizeInMB(t *testing.T) {
testData := []struct {
size string
expectedNumber int
}{
{"1024kb", 1},
{"1024KB", 1},
{"1024mb", 1024},
{"1024b", 0},
}

for _, tt := range testData {
number := CalculateSizeInMB(tt.size)
if number != tt.expectedNumber {
t.Fatalf("Expected '%d'' but got '%d'", tt.expectedNumber, number)
}
}
}

0 comments on commit 56c72e2

Please sign in to comment.