29 lines
565 B
Go
29 lines
565 B
Go
|
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{})
|
||
|
}
|