From 984f50f90599da23c8e42dd116e360aad507581e Mon Sep 17 00:00:00 2001 From: lash Date: Sun, 3 Nov 2024 15:37:46 +0000 Subject: [PATCH] Add voucherlist check in test --- event/nats/nats_test.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/event/nats/nats_test.go b/event/nats/nats_test.go index b3cd366..29783dc 100644 --- a/event/nats/nats_test.go +++ b/event/nats/nats_test.go @@ -15,6 +15,7 @@ import ( "git.grassecon.net/urdt/ussd/config" "git.grassecon.net/urdt/ussd/models" "git.grassecon.net/term/lookup" + "git.grassecon.net/term/event" ) func init() { @@ -200,8 +201,18 @@ func TestHandleMsg(t *testing.T) { if err != nil { t.Fatal(err) } - if len(v) == 0 { + if !bytes.Contains(v, []byte("abcdef")) { t.Fatal("no transaction data") } - t.Logf("tx %s", v) + + userDb.SetPrefix(event.DATATYPE_USERSUB) + userDb.SetSession(aliceSession) + k := append([]byte("vouchers"), []byte("sym")...) + v, err = userDb.Get(ctx, k) + if err != nil { + t.Fatal(err) + } + if !bytes.Contains(v, []byte("1:FOO")) { + t.Fatalf("expected '1:FOO', got %s", v) + } }