fix: cli test
This commit is contained in:
parent
273ba3e943
commit
d8c3c29ff8
@ -1,6 +1,7 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"github.com/danielmiessler/fabric/core"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
@ -9,8 +10,10 @@ import (
|
||||
)
|
||||
|
||||
func TestCli(t *testing.T) {
|
||||
os.Args = os.Args[:1]
|
||||
message, err := Cli("test")
|
||||
assert.NoError(t, err)
|
||||
assert.Error(t, err)
|
||||
assert.Equal(t, core.NoSessionPatternUserMessages, err.Error())
|
||||
assert.Empty(t, message)
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,8 @@ import (
|
||||
const DefaultPatternsGitRepoUrl = "https://github.com/danielmiessler/fabric.git"
|
||||
const DefaultPatternsGitRepoFolder = "patterns"
|
||||
|
||||
const NoSessionPatternUserMessages = "no session, pattern or user messages provided"
|
||||
|
||||
func NewFabric(db *db.Db) (ret *Fabric, err error) {
|
||||
ret = NewFabricBase(db)
|
||||
err = ret.Configure()
|
||||
@ -279,7 +281,7 @@ func (o *Chat) BuildChatSession(raw bool) (ret *db.Session, err error) {
|
||||
|
||||
if ret.IsEmpty() {
|
||||
ret = nil
|
||||
err = fmt.Errorf("no session, pattern or user messages provided")
|
||||
err = fmt.Errorf(NoSessionPatternUserMessages)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user