forked from deusdat/arangomigo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
impl_test.go
98 lines (81 loc) · 1.78 KB
/
impl_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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
package main
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
driver "github.com/arangodb/go-driver"
)
type MockDB struct {
driver.Database
}
func (mdb MockDB) Collection(ctx context.Context, name string) (driver.Collection, error) {
col := MockCol{name: "FakeIndex"}
return col, nil
}
type MockCol struct {
driver.Collection
name string
}
func (mc MockCol) Name() string {
return mc.name
}
func TestHashRejectDelete(t *testing.T) {
hi := HashIndex{}
hi.Action = DELETE
//assert.Panics(t, func() {
err := hi.migrate(
context.Background(),
MockDB{},
nil,
)
//})
assert.EqualError(t, err, "Due to Arango API limitations, you cannot delete an index")
}
func TestFullTextRejectDelete(t *testing.T) {
hi := FullTextIndex{}
hi.Action = DELETE
//assert.Panics(t, func() {
err := hi.migrate(
context.Background(),
MockDB{},
nil,
)
//})
assert.EqualError(t, err, "Due to Arango API limitations, you cannot delete an index")
}
func TestGeoRejectDelete(t *testing.T) {
hi := GeoIndex{}
hi.Action = DELETE
//assert.Panics(t, func() {
err := hi.migrate(
context.Background(),
MockDB{},
nil,
)
//})
assert.EqualError(t, err, "Due to Arango API limitations, you cannot delete an index")
}
func TestPersistentRejectDelete(t *testing.T) {
hi := PersistentIndex{}
hi.Action = DELETE
//assert.Panics(t, func() {
err := hi.migrate(
context.Background(),
MockDB{},
nil,
)
//})
assert.EqualError(t, err, "Due to Arango API limitations, you cannot delete an index")
}
func TestSkipListRejectDelete(t *testing.T) {
hi := SkiplistIndex{}
hi.Action = DELETE
//assert.Panics(t, func() {
err := hi.migrate(
context.Background(),
MockDB{},
nil,
)
//})
assert.EqualError(t, err, "Due to Arango API limitations, you cannot delete an index")
}