From f2402d569428d3a279fd305d9a47f1498829a731 Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Fri, 26 Apr 2024 20:57:59 -0600 Subject: [PATCH] tests --- lib/imgbundler/imgbundler_test.go | 50 ++++++++++++++++++++++++++++-- lib/imgbundler/nested/test_svg.svg | 7 +++++ 2 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 lib/imgbundler/nested/test_svg.svg diff --git a/lib/imgbundler/imgbundler_test.go b/lib/imgbundler/imgbundler_test.go index a8ebe37cd..f70ed5a1c 100644 --- a/lib/imgbundler/imgbundler_test.go +++ b/lib/imgbundler/imgbundler_test.go @@ -17,6 +17,7 @@ import ( "oss.terrastruct.com/d2/lib/log" "oss.terrastruct.com/d2/lib/simplelog" + "oss.terrastruct.com/util-go/go2" ) //go:embed test_png.png @@ -167,7 +168,7 @@ func TestInlineLocal(t *testing.T) { t.Fatal(err) } - sampleSVG := fmt.Sprintf(` + template := ` -`, svgURL, pngURL) +` + sampleSVG := fmt.Sprintf(template, svgURL, pngURL) l := simplelog.FromLibLog(ctx) - out, err := BundleLocal(ctx, l, []byte(sampleSVG), false) + // It doesn't matter what the inputPath is for absolute paths + out, err := BundleLocal(ctx, l, "asdf", []byte(sampleSVG), false) if err != nil { t.Fatal(err) } @@ -208,6 +211,47 @@ width="328" height="587" viewBox="-100 -131 328 587">