add unit tests

This commit is contained in:
MaysWind
2024-11-16 15:07:32 +08:00
parent 3a7ad429c2
commit 3ee1683349
4 changed files with 132 additions and 0 deletions
@@ -181,4 +181,17 @@ func TestBankOfCanadaDataSource_InvalidRate(t *testing.T) {
"}"))
assert.Equal(t, nil, err)
assert.Len(t, actualLatestExchangeRateResponse.ExchangeRates, 0)
actualLatestExchangeRateResponse, err = dataSource.Parse(context, []byte("{"+
" \"observations\": [\n"+
" {\n"+
" \"d\": \"2021-04-01\",\n"+
" \"FXUSDCAD\": {\n"+
" \"v\": \"0\"\n"+
" }\n"+
" }\n"+
" ]\n"+
"}"))
assert.Equal(t, nil, err)
assert.Len(t, actualLatestExchangeRateResponse.ExchangeRates, 0)
}