Files
narratio/internal/artifacts/product_path_test.go

20 lines
531 B
Go
Raw Normal View History

2026-11-30 04:02:53 +00:00
package artifacts
import (
"path/filepath"
"testing"
)
func TestProductRelativePath(t *testing.T) {
root := t.TempDir()
for _, configured := range []string{"artifacts/recap.md", filepath.Join(root, "artifacts", "recap.md")} {
got, err := ProductRelativePath(root, configured)
if err != nil || got != "artifacts/recap.md" {
t.Fatalf("%q: %q, %v", configured, got, err)
}
}
if _, err := ProductRelativePath(root, filepath.Join(t.TempDir(), "recap.md")); err == nil {
t.Fatal("outside absolute path accepted")
}
}