Skip to content

Commit

Permalink
Increase code coverage
Browse files Browse the repository at this point in the history
* New tests added.

Signed-off-by: Gökhan Özeloğlu <gokhan.ozeloglu@deliveryhero.com>
  • Loading branch information
Gökhan Özeloğlu committed Apr 19, 2023
1 parent f85fd32 commit 9d29c49
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions currency_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,60 @@ func TestFetchCurrency(t *testing.T) {
})
}
}

func TestCurrency_ForexBuying(t *testing.T) {
c := &Currency{
code: "EUR",
forexBuying: "15.324",
}

fb := c.ForexBuying()
if fb != "15.324" {
t.Errorf("expected: 15.324\ngot: %s", fb)
}
}

func TestCurrency_ForexSelling(t *testing.T) {
c := &Currency{
code: "EUR",
forexSelling: "14.987",
}

fs := c.ForexSelling()
if fs != "14.987" {
t.Errorf("expected: 14.987\ngot: %s", fs)
}
}

func TestCurrency_BanknoteBuying(t *testing.T) {
c := &Currency{
code: "EUR",
banknoteBuying: "15.487",
}

bb := c.BanknoteBuying()
if bb != "15.487" {
t.Errorf("expected: 15.487\ngot: %s", bb)
}
}

func TestCurrency_BanknoteSelling(t *testing.T) {
c := &Currency{
code: "EUR",
banknoteSelling: "15.426",
}

bs := c.BanknoteSelling()
if bs != "15.426" {
t.Errorf("expected: 15.426\ngot: %s", bs)
}
}

func TestTermFrom(t *testing.T) {
date := "04062023"
term := termFrom(date)

if term != "202306" {
t.Errorf("expected: 202306\ngot: %s", term)
}
}

0 comments on commit 9d29c49

Please sign in to comment.