func TestViewModifyErrorGetSearchView(t *testing.T) {
	view := SearchView{}
	view.Action = MODIFY
	view.Name = "GetSearchViewError"
	err := view.Migrate(
		context.Background(),
		MockDB{},
		nil)
	assert.EqualError(t, err, "Couldn't get ArangoSearchView 'GetSearchViewError' to update: this is just a test")
}
Test the error is handled when getting the ArangoSearchView from a view.
package arangomigo
import (
	"context"
	"errors"
	"github.com/stretchr/testify/assert"
	"testing"
	driver "github.com/arangodb/go-driver"
)
type MockView struct {
	driver.View
	name string
}
func (mv MockView) Name() string {
	return mv.name
}
func (mv MockView) ArangoSearchView() (driver.ArangoSearchView, error) {
	if "GetSearchViewError" == mv.Name() {
		return nil, errors.New("this is just a test")
	}
	return MockArangoSearchView{
		name:mv.Name(),
	}, nil
}
func (mv MockView) Remove(ctx context.Context) error {
	return errors.New("this is just a test")
}
type MockArangoSearchView struct {
	name string
}
func (mv MockArangoSearchView) Name() string {
	return mv.name
}
func (mv MockArangoSearchView) Type() driver.ViewType {
	return driver.ViewTypeArangoSearch
}
func (mv MockArangoSearchView) Properties(ctx context.Context) (driver.ArangoSearchViewProperties, error) {
	return driver.ArangoSearchViewProperties{}, nil
}
func (mv MockArangoSearchView) ArangoSearchView() (driver.ArangoSearchView, error) {
	return nil, nil
}
func (mv MockArangoSearchView) Database() driver.Database {
	return nil
}
func (mv MockArangoSearchView) Remove(ctx context.Context) error {
	return nil
}
func (mv MockArangoSearchView) SetProperties(ctx context.Context, options driver.ArangoSearchViewProperties) error {
	return errors.New("this is just a test")
}
func (mdb MockDB) CreateArangoSearchView(ctx context.Context, name string, options *driver.ArangoSearchViewProperties) (driver.ArangoSearchView, error) {
	return nil, errors.New("this is just a test")
}
func (mdb MockDB) View(ctx context.Context, name string) (driver.View, error) {
	if name == "ViewError" {
		return nil, errors.New("this is just a test")
	}
	return MockView{
		name: name,
	}, nil
}
func TestViewCreateError(t *testing.T) {
	view := SearchView{}
	view.Action = CREATE
	view.Name = "TestView"
	err := view.Migrate(
		context.Background(),
		MockDB{},
		nil)
	assert.EqualError(t, err, "Couldn't create view 'TestView': this is just a test")
}
func TestViewDeleteErrorGetting(t *testing.T) {
	view := SearchView{}
	view.Action = DELETE
	view.Name = "ViewError"
	err := view.Migrate(
		context.Background(),
		MockDB{},
		nil)
	assert.EqualError(t, err, "Couldn't find view 'ViewError' to delete: this is just a test")
}
func TestViewDeleteErrorRemove(t *testing.T) {
	view := SearchView{}
	view.Action = DELETE
	view.Name = "TestView"
	err := view.Migrate(
		context.Background(),
		MockDB{},
		nil)
	assert.EqualError(t, err, "Couldn't delete view 'TestView': this is just a test")
}
func TestViewModifyErrorGetting(t *testing.T) {
	view := SearchView{}
	view.Action = MODIFY
	view.Name = "ViewError"
	err := view.Migrate(
		context.Background(),
		MockDB{},
		nil)
	assert.EqualError(t, err, "Couldn't find view 'ViewError' to update: this is just a test")
}