MCPcopy
hub / github.com/pocketbase/pocketbase / TestFileSystemUpload

Function TestFileSystemUpload

tools/filesystem/filesystem_test.go:308–328  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

306}
307
308func TestFileSystemUpload(t *testing.T) {
309 dir := createTestDir(t)
310 defer os.RemoveAll(dir)
311
312 fsys, err := filesystem.NewLocal(dir)
313 if err != nil {
314 t.Fatal(err)
315 }
316 defer fsys.Close()
317
318 fileKey := "newdir/newkey.txt"
319
320 uploadErr := fsys.Upload([]byte("demo"), fileKey)
321 if uploadErr != nil {
322 t.Fatal(uploadErr)
323 }
324
325 if exists, _ := fsys.Exists(fileKey); !exists {
326 t.Fatalf("Expected %s to exist", fileKey)
327 }
328}
329
330func TestFileSystemServe(t *testing.T) {
331 dir := createTestDir(t)

Callers

nothing calls this directly

Calls 6

NewLocalFunction · 0.92
createTestDirFunction · 0.70
CloseMethod · 0.65
RemoveAllMethod · 0.45
UploadMethod · 0.45
ExistsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…