예제 #1
0
파일: action_test.go 프로젝트: ainoya/fune
func TestInstallAction(t *testing.T) {
	NewActions(nil)
	actionName := "mock"

	InstallAction(actionName, &MockAction{}, NewMockAction)

	a := repository.InstalledActions[actionName].NewFunc()

	assert.IsType(t, a, NewMockAction())
	ClearActions()
}
예제 #2
0
파일: action_test.go 프로젝트: ainoya/fune
func TestEnableActions(t *testing.T) {
	NewActions(nil)
	actionName := "mock"

	InstallAction(actionName, &MockAction{}, NewMockAction)
	EnableActions([]string{actionName})

	enabled := repository.EnabledActions[actionName]

	assert.IsType(t, enabled, NewMockAction())
	ClearActions()
}
예제 #3
0
파일: action_test.go 프로젝트: ainoya/fune
func TestNewActions(t *testing.T) {
	a := NewActions(nil)

	assert.IsType(t, a, &ActionRepository{})
	assert.Equal(t, a.EnabledActions, Actions())
	assert.Equal(t, a, repository)

	ClearActions()

	assert.Nil(t, repository.EnabledActions)
	assert.Nil(t, Actions())
}
예제 #4
0
파일: action_test.go 프로젝트: ainoya/fune
func TestRegisterAction(t *testing.T) {
	NewActions(nil)

	addr := &ActionAddress{
		NewFunc: NewMockAction,
	}

	RegisterAction(addr)

	registered := repository.EnabledActions["mock"]
	assert.IsType(t, registered, NewMockAction())

	ClearActions()
}