forked from apilayer/goiban-data
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathin_memory_store_test.go
More file actions
43 lines (30 loc) · 793 Bytes
/
Copy pathin_memory_store_test.go
File metadata and controls
43 lines (30 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package data_test
import (
"testing"
data "github.com/fourcube/goiban-data"
)
func TestStoreInMemory(t *testing.T) {
store := data.NewInMemoryStore()
data := data.BankInfo{Bankcode: "12345", Country: "DE"}
ok, err := store.Store(data)
if !ok || err != nil {
t.Errorf("Test failed: %v %v", ok, err)
}
record, _ := store.Find("DE", "12345")
if *record != data {
t.Errorf("Failed to find data in store")
}
}
func TestClearInMemory(t *testing.T) {
store := data.NewInMemoryStore()
data := data.BankInfo{Bankcode: "12345", Country: "DE", Source: "Foo"}
ok, err := store.Store(data)
if !ok || err != nil {
t.Errorf("Test failed: %v %v", ok, err)
}
store.Clear("Foo")
record, _ := store.Find("DE", "12345")
if record != nil {
t.Errorf("Data not deleted!")
}
}