Blob


1 package fs
3 import (
4 "io/fs"
5 "net/http"
6 "testing"
7 "testing/fstest"
9 "olowe.co/apub/lemmy"
10 )
12 // ds9.lemmy.ml is a test instance run by the Lemmy maintainers.
13 func TestFS(t *testing.T) {
14 if _, err := http.Head("https://ds9.lemmy.ml"); err != nil {
15 t.Skip(err)
16 }
17 fsys := &FS{
18 Client: &lemmy.Client{
19 Address: "ds9.lemmy.ml",
20 Debug: true,
21 },
22 }
23 _, err := fsys.Open("zzztestcommunity1")
24 if err != nil {
25 t.Fatal(err)
26 }
27 _, err = fs.ReadFile(fsys, "zzztestcommunity1/447/331")
28 if err != nil {
29 t.Fatal(err)
30 }
32 if err := fstest.TestFS(fsys, "zzztestcommunity1", "zzztestcommunity1/447/post", "zzztestcommunity1/447/331"); err != nil {
33 t.Fatal(err)
34 }
35 }