blob: 343affc160225a4702a67ae43e694e2bbff490da (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package vespa
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestIdToURLPath(t *testing.T) {
assertIdToURLPath("ns/type/docid/local", "id:ns:type::local", t)
assertIdToURLPath("ns/type/number/123/docid/local", "id:ns:type:n=123:local", t)
assertIdToURLPath("ns/type/group/mygroup/docid/local", "id:ns:type:g=mygroup:local", t)
}
func assertIdToURLPath(expectedPath string, id string, t *testing.T) {
path, err := IdToURLPath(id)
assert.Nil(t, err)
assert.Equal(t, expectedPath, path)
}
|