Add background mount path helpers
This commit is contained in:
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"bazil.org/fuse"
|
||||
@@ -36,6 +37,27 @@ func TestBuildMountTreeGroupsByFolderAndDate(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestItemIDFromURLOrID(t *testing.T) {
|
||||
if got := itemIDFromURLOrID("https://docspell.example/app/item/item-123"); got != "item-123" {
|
||||
t.Fatalf("expected item-123, got %q", got)
|
||||
}
|
||||
if got := itemIDFromURLOrID("item-456"); got != "item-456" {
|
||||
t.Fatalf("expected raw id, got %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestItemIDFromLocalByIDPath(t *testing.T) {
|
||||
mountPath := t.TempDir()
|
||||
path := filepath.Join(mountPath, "by-id", "it", "item-1.pdf")
|
||||
got, err := itemIDFromLocalPath(path, config{MountPath: mountPath})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got != "item-1" {
|
||||
t.Fatalf("expected item-1, got %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildMountTreeDeduplicatesAttachmentNames(t *testing.T) {
|
||||
items := []SearchItem{{
|
||||
ID: "item-1",
|
||||
|
||||
Reference in New Issue
Block a user