MCPcopy Create free account
hub / github.com/chanify/chanify / TestTooLargeSaveTextFailed

Function TestTooLargeSaveTextFailed

core/sender_test.go:643–662  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

641}
642
643func TestTooLargeSaveTextFailed(t *testing.T) {
644 fpath := filepath.Join(os.TempDir(), "files")
645 defer os.RemoveAll(fpath)
646 os.MkdirAll(fpath, os.ModePerm) // nolint: errcheck
647 if f, err := os.Create(filepath.Join(fpath, "files")); err != nil {
648 f.Close()
649 }
650 logic.APIEndpoint = "http://127.0.0.1"
651 c := New()
652 defer c.Close()
653 c.Init(&logic.Options{DBUrl: "sqlite://?mode=memory", FilePath: fpath}) // nolint: errcheck
654
655 tk, _ := model.ParseToken("EgMxMjMiBGNoYW4qBU1GUkdHMhQZZ_-_F4Oa-oQO0sLHXKqNSU8Qmw..c2lnbg") // nolint: errcheck
656 w := httptest.NewRecorder()
657 ctx, _ := gin.CreateTestContext(w)
658 ctx.Request, _ = http.NewRequest("GET", "/", nil)
659 if _, err := c.makeTextContent(model.NewMessage(tk), strings.Repeat("1", 500), strings.Repeat("2", 2000), "", "1", nil); err == nil {
660 t.Error("Check save too large text failed")
661 }
662}
663
664func TestSendAction(t *testing.T) {
665 logic.APIEndpoint = "http://127.0.0.1"

Callers

nothing calls this directly

Calls 6

ParseTokenFunction · 0.92
NewMessageFunction · 0.92
NewFunction · 0.85
InitMethod · 0.80
makeTextContentMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected