47 lines
1.1 KiB
Go
47 lines
1.1 KiB
Go
package mock
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"github.com/abelith/spellbook/internal/adapters/caster"
|
|
"github.com/abelith/spellbook/internal/models"
|
|
)
|
|
|
|
var testSpell = models.Spell{
|
|
Id: 0,
|
|
Name: "test",
|
|
Spell: "curl {{.target}}",
|
|
ShortDesc: "test spell",
|
|
Tags: []string{"tag1", "tag2", "tag3"},
|
|
}
|
|
|
|
type Application struct{}
|
|
|
|
func (a *Application) AddSpell(_ context.Context, spell models.Spell) error {
|
|
fmt.Println("TEST - AddSpell", spell)
|
|
return nil
|
|
}
|
|
|
|
func (a *Application) GetSpell(_ context.Context, spellName string) (models.Spell, error) {
|
|
fmt.Println("TEST - GetSpell", spellName)
|
|
return testSpell, nil
|
|
}
|
|
|
|
func (a *Application) GetSpells(_ context.Context, query models.SearchQuery) ([]models.Spell, error) {
|
|
fmt.Println("TEST - GetSpells", query)
|
|
|
|
return []models.Spell{
|
|
testSpell,
|
|
}, nil
|
|
}
|
|
|
|
func (a *Application) DeleteSpell(_ context.Context, spellName string) error {
|
|
fmt.Println("TEST - DeleteSpell", spellName)
|
|
return nil
|
|
}
|
|
|
|
func (a *Application) CastSpell(ctx context.Context, spellCast models.SpellCast) (models.CastResult, error) {
|
|
fmt.Println("TEST - CastSpell")
|
|
return (&caster.SpellCaster{}).Cast(ctx, spellCast)
|
|
}
|