-
-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathindex_model_test.go
59 lines (53 loc) · 1.06 KB
/
index_model_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright 2023 Princess B33f Heavy Industries / Dave Shanley
// SPDX-License-Identifier: MIT
package index
import (
"encoding/json"
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v3"
"testing"
)
func TestSpecIndex_GetConfig(t *testing.T) {
idx1 := NewTestSpecIndex()
c := SpecIndexConfig{}
idx1.config = &c
assert.Equal(t, &c, idx1.GetConfig())
}
func Test_MarshalJSON(t *testing.T) {
rm := &ReferenceMapped{
OriginalReference: &Reference{
FullDefinition: "full definition",
Path: "path",
Node: &yaml.Node{
Line: 1,
Column: 1,
Content: []*yaml.Node{
{
Line: 9,
Column: 10,
},
{
Value: "lemon cake",
},
},
},
},
Reference: &Reference{
FullDefinition: "full definition",
Path: "path",
Node: &yaml.Node{
Line: 2,
Column: 2,
},
KeyNode: &yaml.Node{
Line: 3,
Column: 3,
},
},
Definition: "definition",
FullDefinition: "full definition",
IsPolymorphic: true,
}
bytes, _ := json.Marshal(rm)
assert.Len(t, bytes, 173)
}