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

Function TestTooLargeText

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

Source from the content-addressed store, hash-verified

592}
593
594func TestTooLargeText(t *testing.T) {
595 fpath := filepath.Join(os.TempDir(), "files")
596 defer os.RemoveAll(fpath)
597 os.MkdirAll(fpath+"/files/", os.ModePerm) // nolint: errcheck
598 logic.APIEndpoint = "http://127.0.0.1"
599 c := New()
600 defer c.Close()
601 c.Init(&logic.Options{DBUrl: "sqlite://?mode=memory", FilePath: fpath}) // nolint: errcheck
602
603 tk, _ := model.ParseToken("EgMxMjMiBGNoYW4qBU1GUkdHMhQZZ_-_F4Oa-oQO0sLHXKqNSU8Qmw..c2lnbg") // nolint: errcheck
604 w := httptest.NewRecorder()
605 ctx, _ := gin.CreateTestContext(w)
606 ctx.Request, _ = http.NewRequest("GET", "/", nil)
607 if _, err := c.makeTextContent(model.NewMessage(tk), strings.Repeat("1", 1001), strings.Repeat("2", 1001), "", "1", nil); err != nil {
608 t.Error("Fix too large text failed", err)
609 }
610}
611
612func TestTooLargeTextNoTitle(t *testing.T) {
613 fpath := filepath.Join(os.TempDir(), "files")

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