package uuidv7

import "testing"

func TestParsePathLikeString(t *testing.T) {
	t.Parallel()

	want := "019f1b8b-040d-7669-800c-d2ae52a53646"
	cases := []string{
		want,
		want + "/",
		"https://api-wfm-dev.mybit.co.id/wopi/files/" + want,
		"https://api-wfm-dev.mybit.co.id/wopi/files/" + want + "/contents",
		"https%3A%2F%2Fapi-wfm-dev.mybit.co.id%2Fwopi%2Ffiles%2F" + want,
		"https%3A%2F%2Fapi-wfm-dev.mybit.co.id%2Fwopi%2Ffiles%2F" + want + "%2Fcontents",
		"WOPISrc=https%3A%2F%2Fapi-wfm-dev.mybit.co.id%2Fwopi%2Ffiles%2F" + want,
		"/wopi/files/" + want + "/contents",
	}

	for _, tc := range cases {
		tc := tc
		t.Run(tc, func(t *testing.T) {
			t.Parallel()

			parsed, err := ParsePathLikeString(tc)
			if err != nil {
				t.Fatalf("ParsePathLikeString(%q) error = %v", tc, err)
			}
			got, err := BytesToString(parsed)
			if err != nil {
				t.Fatalf("BytesToString error = %v", err)
			}
			if got != want {
				t.Fatalf("ParsePathLikeString(%q) = %q, want %q", tc, got, want)
			}
		})
	}
}
