Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alixander committed Nov 24, 2024
1 parent 7a4ea25 commit 1ecadc5
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 7 deletions.
7 changes: 7 additions & 0 deletions d2ast/d2ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,13 @@ func (kp *KeyPath) IDA() (ida []String) {
return ida
}

func (kp *KeyPath) StringIDA() (ida []string) {
for _, el := range kp.Path {
ida = append(ida, el.Unbox().ScalarString())
}
return ida
}

func (kp *KeyPath) Copy() *KeyPath {
kp2 := *kp
kp2.Path = nil
Expand Down
2 changes: 1 addition & 1 deletion d2cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func Run(ctx context.Context, ms *xmain.State) (err error) {
if err != nil {
return xmain.UsageErrorf("invalid target: %s", *targetFlag)
}
boardPath = key.IDA()
boardPath = key.StringIDA()
}

ctx, cancel := timelib.WithTimeout(ctx, time.Minute*2)
Expand Down
6 changes: 1 addition & 5 deletions d2compiler/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -1230,11 +1230,7 @@ func (c *compiler) validateBoardLinks(g *d2graph.Graph) {
continue
}

formattedIDA := []string{}
for _, id := range linkKey.IDA() {
formattedIDA = append(formattedIDA, id.ScalarString())
}
if slices.Equal(formattedIDA, obj.Graph.IDA()) {
if slices.Equal(linkKey.StringIDA(), obj.Graph.IDA()) {
obj.Link = nil
continue
}
Expand Down
2 changes: 1 addition & 1 deletion d2lsp/d2lsp.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func GetRefRanges(path string, fs map[string]string, boardPath []string, key str
var f *d2ir.Field
if mk.Key != nil {
for _, p := range mk.Key.Path {
f = m.GetField(p.Unbox().ScalarString())
f = m.GetField(p.Unbox())
if f == nil {
return nil, nil, nil
}
Expand Down
Binary file modified e2etests-cli/testdata/TestCLI_E2E/internal_linked_pdf.exp.pdf
Binary file not shown.
Binary file modified e2etests-cli/testdata/TestCLI_E2E/no-nav-pdf.exp.pdf
Binary file not shown.
Binary file modified e2etests-cli/testdata/TestCLI_E2E/renamed-board.exp.pdf
Binary file not shown.
Binary file modified e2etests-cli/testdata/TestCLI_E2E/theme-pdf.exp.pdf
Binary file not shown.

0 comments on commit 1ecadc5

Please sign in to comment.