31 lines
649 B
Go
31 lines
649 B
Go
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
|
|
|
|
package data
|
|
|
|
import (
|
|
"testing"
|
|
"github.com/redis/go-redis/v9"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestNewDataSource(t *testing.T) {
|
|
ds := NewSource()
|
|
if ds == nil {
|
|
t.Errorf("Failed creating new data source")
|
|
}
|
|
}
|
|
|
|
func TestDataSourceOpen(t *testing.T) {
|
|
ds := NewSource()
|
|
assert.Equal(t, ds.Open(), nil)
|
|
}
|
|
|
|
type MockConnection struct {}
|
|
|
|
func (m *MockConnection) LRange(context.Context, string, int64, int64) (*redis.StringSliceCmd) { return }
|
|
|
|
func TestDataSourceGet(t *testing.T) {
|
|
ds := NewSource()
|
|
ds.Use(&MockConnection{})
|
|
}
|