Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
meabed committed Sep 26, 2018
1 parent c3780b0 commit caf41da
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions cmd/server/convert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ func TestConvertObj_Convert(t *testing.T) {
],
"from": "USD",
"to": "AED"
}`, `{
"amount": 5.5,
"exchanger": [
{
"name": "yahoo",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
}
],
"from": "USD",
"to": "AED"
}`,
`{
"amount": 4.5,
Expand Down Expand Up @@ -76,10 +86,17 @@ func TestConvertObj_Convert(t *testing.T) {
}`,
}

expected := map[int]string{
expectedName := map[int]string{
0: "google",
1: "yahoo",
2: "google",
2: "yahoo",
3: "google",
}
expectedRateCache := map[int]string{
0: "false",
1: "false",
2: "true",
3: "false",
}

for k, payload := range payloadArr {
Expand All @@ -93,6 +110,7 @@ func TestConvertObj_Convert(t *testing.T) {
r.Body = ioutil.NopCloser(bytePayloadReader)

Convert(w, r)
assert.Contains(t, testResponse, expected[k])
assert.Contains(t, testResponse, expectedName[k])
assert.Contains(t, testResponse, expectedRateCache[k])
}
}

0 comments on commit caf41da

Please sign in to comment.