add test
This commit is contained in:
parent
b7b58c5921
commit
4d136e0946
1 changed files with 35 additions and 1 deletions
|
|
@ -30,6 +30,7 @@ func TestCreate(t *testing.T) {
|
||||||
boardPath []string
|
boardPath []string
|
||||||
name string
|
name string
|
||||||
text string
|
text string
|
||||||
|
fsTexts map[string]string
|
||||||
key string
|
key string
|
||||||
|
|
||||||
expKey string
|
expKey string
|
||||||
|
|
@ -799,6 +800,38 @@ steps: {
|
||||||
exp: `a
|
exp: `a
|
||||||
d
|
d
|
||||||
|
|
||||||
|
steps: {
|
||||||
|
x: {
|
||||||
|
b
|
||||||
|
d 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "image-edge",
|
||||||
|
|
||||||
|
text: `...@k
|
||||||
|
a.b: {
|
||||||
|
icon: https://icons.terrastruct.com/essentials/004-picture.svg
|
||||||
|
shape: image
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
fsTexts: map[string]string{
|
||||||
|
"k.d2": `
|
||||||
|
a: {
|
||||||
|
b
|
||||||
|
c
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
key: `a.b -> a.c`,
|
||||||
|
boardPath: []string{},
|
||||||
|
|
||||||
|
expKey: `d 2`,
|
||||||
|
exp: `a
|
||||||
|
d
|
||||||
|
|
||||||
steps: {
|
steps: {
|
||||||
x: {
|
x: {
|
||||||
b
|
b
|
||||||
|
|
@ -817,6 +850,7 @@ steps: {
|
||||||
var newKey string
|
var newKey string
|
||||||
et := editTest{
|
et := editTest{
|
||||||
text: tc.text,
|
text: tc.text,
|
||||||
|
fsTexts: tc.fsTexts,
|
||||||
testFunc: func(g *d2graph.Graph) (*d2graph.Graph, error) {
|
testFunc: func(g *d2graph.Graph) (*d2graph.Graph, error) {
|
||||||
var err error
|
var err error
|
||||||
g, newKey, err = d2oracle.Create(g, tc.boardPath, tc.key)
|
g, newKey, err = d2oracle.Create(g, tc.boardPath, tc.key)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue