forked from mrz1836/go-datastore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathengine_test.go
43 lines (36 loc) · 1.08 KB
/
engine_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package datastore
import (
"testing"
"github.com/stretchr/testify/assert"
)
// TestEngine_String will test the method String()
func TestEngine_String(t *testing.T) {
t.Run("valid name", func(t *testing.T) {
assert.Equal(t, "empty", Empty.String())
assert.Equal(t, "mongodb", MongoDB.String())
assert.Equal(t, "mysql", MySQL.String())
assert.Equal(t, "postgresql", PostgreSQL.String())
assert.Equal(t, "sqlite", SQLite.String())
})
}
// TestEngine_IsEmpty will test the method IsEmpty()
func TestEngine_IsEmpty(t *testing.T) {
t.Run("actually empty", func(t *testing.T) {
assert.True(t, Empty.IsEmpty())
})
t.Run("not empty", func(t *testing.T) {
assert.False(t, MySQL.IsEmpty())
})
}
// TestIsSQLEngine will test the method IsSQLEngine()
func TestIsSQLEngine(t *testing.T) {
t.Run("test sql databases", func(t *testing.T) {
assert.True(t, IsSQLEngine(MySQL))
assert.True(t, IsSQLEngine(PostgreSQL))
assert.True(t, IsSQLEngine(SQLite))
})
t.Run("test other databases", func(t *testing.T) {
assert.False(t, IsSQLEngine(MongoDB))
assert.False(t, IsSQLEngine(Empty))
})
}