Vectrum
Sign In
15 lines · 474 Bytes · Go
package main

import (
	"path/filepath"
	"testing"
)

func TestMetricsPathLeavesAbsolutePathsAlone(t *testing.T) {
	if got := metricsPath("/work", "/var/log/codey/events.jsonl"); got != "/var/log/codey/events.jsonl" {
		t.Errorf("absolute -metrics was moved under the root: %s", got)
	}
	if got := metricsPath("/work", ".codey/events.jsonl"); got != filepath.Join("/work", ".codey/events.jsonl") {
		t.Errorf("relative -metrics should anchor to the root, got %s", got)
	}
}