forked from noebs/noebs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpers_test.go
More file actions
32 lines (29 loc) · 783 Bytes
/
helpers_test.go
File metadata and controls
32 lines (29 loc) · 783 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
package main
import (
"reflect"
"testing"
)
func Test_additionalFieldsToHash(t *testing.T) {
a := `SalesAmount=10.3;FixedFee=22.3;Token=23232;MeterNumber=12345;CustomerName=mohamed`
want := map[string]interface{}{
"SalesAmount": "10.3", "FixedFee": "22.3", "Token": "23232", "MeterNumber": "12345", "CustomerName": "mohamed",
}
tests := []struct {
name string
args string
want map[string]interface{}
}{
{"successful case - nec", a, want},
{"failed case - nec", "", want},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := additionalFieldsToHash(tt.args)
if err != nil {
t.Errorf("Hello there! it worked")
} else if ok := !reflect.DeepEqual(got, tt.want); !ok {
t.Errorf("I cannot pass this test!")
}
})
}
}