Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Fix austria data format; Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fourcube committed Sep 19, 2019
1 parent 50ddc50 commit 9482025
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 20 deletions.
2 changes: 1 addition & 1 deletion countries/at.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func AustriaBankStringToEntry(val string, bankCodeLengthMap map[string]int) *Aus
records, _ := r.ReadAll()
return &AustriaBankFileEntry{
records[0][6],
records[0][19],
records[0][18],
PadLeftZero(records[0][2], bankCodeLength),
}
}
21 changes: 13 additions & 8 deletions countries/at_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@ import (
)

func TestCanConvertStringToAustriaBankEntry(t *testing.T) {
data := "Hauptanstalt;\"10050973\";\"52300\";\"KI\";\"Joint stock banks and private banks\";\"350921k\";\"Addiko Bank AG\";\"Wipplingerstraße 34/4\";\"1010\";\"Wien\";\"\";\"\";\"\";\"\";\"\";\"Wien\";\"050232\";\"050232/3000\";\"[email protected]\";\"HSEEAT2KXXX\";\"www.addiko.com\";\"20130621\";;"
result := AustriaBankStringToEntry(data)
countryCodeToBankCodeMap := map[string]int{
"AT": 5,
}

data := "Hauptanstalt;263575;34322;KI;Raiffeisen;93513w;Raiffeisenbank Mondseeland eGen;Rainerstr. 11;5310;Mondsee;;5310;Mondsee;29;Oberösterreich;06232/3151;06232/315138017;[email protected];RZOOAT2L322;www.mondseeland.com;20.11.1949"

result := AustriaBankStringToEntry(data, countryCodeToBankCodeMap)

if result.Bankcode != "52300" {
t.Errorf("Couldn't parse bank code.")
if result.Bankcode != "34322" {
t.Errorf("Couldn't parse bank code. %v", result.Bankcode)
}
if result.Name != "Addiko Bank AG" {
t.Errorf("Couldn't parse name.")
if result.Name != "Raiffeisenbank Mondseeland eGen" {
t.Errorf("Couldn't parse name. %v", result.Name)
}
if result.Bic != "HSEEAT2KXXX" {
t.Errorf("Couldn't parse bic.", result.Bic)
if result.Bic != "RZOOAT2L322" {
t.Errorf("Couldn't parse bic. %v", result.Bic)
}
}
2 changes: 1 addition & 1 deletion countries/ch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func TestCanConvertSliceToSwitzerlandBankEntry(t *testing.T) {
data := []string{"4", "4750", "0000", "4835", "047501", "4835", "1", "20061020", "1", "1", "2", "CS (Schweiz) AG", "Credit Suisse (Schweiz) AG", "Rue du Simplon 50", "Case postale 210", "1800", "Vevey 1", "021 925 01 11", "021 921 90 87", "", "", "*12-35-2", "CRESCHZZ18A"}
entry := SwitzerlandRowToEntry(data, countryCodeToBankCodeMap)

if entry.Bankcode != "4835" {
if entry.Bankcode != "04835" {
t.Errorf("expected 04835 as bankcode, got %v", entry.Bankcode)
}

Expand Down
18 changes: 9 additions & 9 deletions countries/de_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,28 @@ func TestCanConvertStringToBundesbankEntry(t *testing.T) {
result := BundesbankStringToEntry(data)

if result.Bankcode != "10000000" {
t.Errorf("Couldn't parse bank code.")
t.Error("Couldn't parse bank code.")
}
if result.M != 1 {
t.Errorf("Couldn't parse M.")
t.Error("Couldn't parse M.")
}
if result.Name != "Bundesbank" {
t.Errorf("Couldn't parse name.")
t.Error("Couldn't parse name.")
}
if result.Zip != "10591" {
t.Errorf("Couldn't parse zip.")
t.Error("Couldn't parse zip.")
}
if result.City != "Berlin" {
t.Errorf("Couldn't parse city.")
t.Error("Couldn't parse city.")
}
if result.ShortName != "BBk Berlin" {
t.Errorf("Couldn't parse short name.")
t.Error("Couldn't parse short name.")
}
if result.Pan != 20100 {
t.Errorf("Couldn't parse pan: ", result.Pan)
t.Errorf("Couldn't parse pan: %v", result.Pan)
}
if result.Bic != "MARKDEF1100" {
t.Errorf("Couldn't parse bic.", result.Bic)
t.Errorf("Couldn't parse bic. %v", result.Bic)
}
if result.CheckAlgo != "09" {
t.Errorf("Couldn't parse check algo.")
Expand All @@ -39,7 +39,7 @@ func TestCanConvertStringToBundesbankEntry(t *testing.T) {
t.Errorf("Couldn't parse internal id.")
}
if result.Change != "U" {
t.Errorf("Couldn't parse change.", result.Change)
t.Errorf("Couldn't parse change. %v", result.Change)
}
if result.ToBeDeleted != 0 {
t.Errorf("Couldn't parse to be deleted.")
Expand Down
6 changes: 5 additions & 1 deletion countries/li_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ package countries
import "testing"

func TestCanConvertSliceToLiechtensteinBankEntry(t *testing.T) {
countryCodeToBankCodeMap := map[string]int{
"LI": 4,
}

data := []string{"Bank Alpinum AG", "BALPLI22", "8801"}
entry := LiechtensteinRowToEntry(data)
entry := LiechtensteinRowToEntry(data, countryCodeToBankCodeMap)

if entry.Bankcode != "8801" {
t.Errorf("expected 8801 as bankcode, got %v", entry.Bankcode)
Expand Down

0 comments on commit 9482025

Please sign in to comment.