diff options
author | Özgür Kesim <oec@kesim.org> | 2024-11-10 17:22:54 +0100 |
---|---|---|
committer | Özgür Kesim <oec@kesim.org> | 2024-11-10 17:22:54 +0100 |
commit | b8a1ae8aca5e36ffa90316a66bf826e020c73ef7 (patch) | |
tree | 0be27add95d2c8ede0d3145316748a0c5a357f4e /auction_test.go | |
parent | 9f43ed15415f5063f2d7b2e14f407875ac7bc660 (diff) |
refactor: slight renaming; added (empty) doc.go to nizk
Diffstat (limited to 'auction_test.go')
-rw-r--r-- | auction_test.go | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/auction_test.go b/auction_test.go index 93d9830..04c2590 100644 --- a/auction_test.go +++ b/auction_test.go @@ -1,8 +1,36 @@ package seal -import "testing" +import ( + "encoding/json" + "strings" + "testing" + "time" +) -func TestAuction(t *testing.T) { +func TestParseDescription(t *testing.T) { + var d Description + var desc = ` + { + "start": "2024-11-10T15:04:05Z", + "end": "2024-11-10T18:04:05Z", + "timeout": "10s", + "bitlength": 8, + "currency": "KUDOS", + "type": 0, + "seller": "1234" + } +` + e := json.NewDecoder(strings.NewReader(desc)). + Decode(&d) + if e != nil { + t.Fatal(e) + } -} + if time.Duration(d.Timeout) != 10*time.Second { + t.Fatalf("expected timeout 10s, but got: %v", time.Duration(d.Timeout)) + } + if d.Bitlength != 8 { + t.Fatalf("expected bitlength %d, but got: %d", 8, d.Bitlength) + } +} |