Compare commits

...

2 Commits

View File

@ -2124,20 +2124,19 @@ func TestCheckVouchers(t *testing.T) {
func TestGetVoucherList(t *testing.T) {
sessionId := "session123"
ctx := context.WithValue(context.Background(), "SessionId", sessionId)
spdb := InitializeTestSubPrefixDb(t, ctx)
ctx, store := InitializeTestStore(t)
ctx = context.WithValue(ctx, "SessionId", sessionId)
// Initialize MenuHandlers
h := &MenuHandlers{
prefixDb: spdb,
userdataStore: store,
ReplaceSeparatorFunc: mockReplaceSeparator,
}
mockSyms := []byte("1:SRF\n2:MILO")
// Put voucher sym data from the store
err := spdb.Put(ctx, storedb.ToBytes(storedb.DATA_VOUCHER_SYMBOLS), mockSyms)
err := store.WriteEntry(ctx, sessionId, storedb.DATA_VOUCHER_SYMBOLS, mockSyms)
if err != nil {
t.Fatal(err)
}
@ -2157,15 +2156,11 @@ func TestViewVoucher(t *testing.T) {
}
ctx, store := InitializeTestStore(t)
sessionId := "session123"
ctx = context.WithValue(ctx, "SessionId", sessionId)
spdb := InitializeTestSubPrefixDb(t, ctx)
h := &MenuHandlers{
userdataStore: store,
flagManager: fm,
prefixDb: spdb,
}
// Define mock voucher data
@ -2178,7 +2173,7 @@ func TestViewVoucher(t *testing.T) {
// Put the data
for key, value := range mockData {
err = spdb.Put(ctx, []byte(storedb.ToBytes(key)), []byte(value))
err := store.WriteEntry(ctx, sessionId, key, []byte(value))
if err != nil {
t.Fatal(err)
}