diff --git a/lib/imgbundler/imgbundler_test.go b/lib/imgbundler/imgbundler_test.go index 1737d0e1e..ff1a815df 100644 --- a/lib/imgbundler/imgbundler_test.go +++ b/lib/imgbundler/imgbundler_test.go @@ -7,7 +7,6 @@ import ( "fmt" "net/http" "net/http/httptest" - "os" "path/filepath" "strings" "sync" @@ -15,10 +14,7 @@ import ( tassert "github.com/stretchr/testify/assert" - "oss.terrastruct.com/util-go/cmdlog" - "oss.terrastruct.com/util-go/xos" - - "oss.terrastruct.com/util-go/xmain" + "oss.terrastruct.com/d2/lib/log" ) //go:embed test_png.png @@ -53,7 +49,7 @@ func TestRegex(t *testing.T) { func TestInlineRemote(t *testing.T) { imgCache = sync.Map{} - ctx := context.Background() + ctx := log.WithTB(context.Background(), t, nil) svgURL := "https://icons.terrastruct.com/essentials/004-picture.svg" pngURL := "https://cdn4.iconfinder.com/data/icons/smart-phones-technologies/512/android-phone.png" @@ -84,17 +80,6 @@ width="328" height="587" viewBox="-100 -131 328 587"> `, svgURL, pngURL) - ms := &xmain.State{ - Name: "test", - - Stdin: os.Stdin, - Stdout: os.Stdout, - Stderr: os.Stderr, - - Env: xos.NewEnv(os.Environ()), - } - ms.Log = cmdlog.NewTB(ms.Env, t) - httpClient.Transport = roundTripFunc(func(req *http.Request) *http.Response { respRecorder := httptest.NewRecorder() switch req.URL.String() { @@ -168,7 +153,7 @@ width="328" height="587" viewBox="-100 -131 328 587"> `, svgURL, pngURL) - ms := &xmain.State{ - Name: "test", - - Stdin: os.Stdin, - Stdout: os.Stdout, - Stderr: os.Stderr, - - Env: xos.NewEnv(os.Environ()), - } - ms.Log = cmdlog.NewTB(ms.Env, t) out, err := BundleLocal(ctx, []byte(sampleSVG), false) if err != nil { t.Fatal(err) @@ -233,7 +208,7 @@ width="328" height="587" viewBox="-100 -131 328 587"> `, url1, url2) - ms := &xmain.State{ - Name: "test", - - Stdin: os.Stdin, - Stdout: os.Stdout, - Stderr: os.Stderr, - - Env: xos.NewEnv(os.Environ()), - } - ms.Log = cmdlog.NewTB(ms.Env, t) - count := 0 httpClient.Transport = roundTripFunc(func(req *http.Request) *http.Response { @@ -298,7 +262,7 @@ width="328" height="587" viewBox="-100 -131 328 587"> `, url1, url2) - ms := &xmain.State{ - Name: "test", - - Stdin: os.Stdin, - Stdout: os.Stdout, - Stderr: os.Stderr, - - Env: xos.NewEnv(os.Environ()), - } - ms.Log = cmdlog.NewTB(ms.Env, t) - count := 0 httpClient.Transport = roundTripFunc(func(req *http.Request) *http.Response {