File tree Expand file tree Collapse file tree 2 files changed +9
-11
lines changed
Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ package testutil
33import (
44 "context"
55 "errors"
6- "io/fs"
76
87 "github.com/cybertec-postgresql/pgwatch/v3/api/pb"
98 "github.com/cybertec-postgresql/pgwatch/v3/internal/metrics"
@@ -106,11 +105,3 @@ func (m *MockSourcesReaderWriter) DeleteSource(name string) error {
106105func (m * MockSourcesReaderWriter ) WriteSources (srcs sources.Sources ) error {
107106 return m .WriteSourcesFunc (srcs )
108107}
109-
110- type MockFS struct {
111- OpenFunc func (name string ) (fs.File , error )
112- }
113-
114- func (m MockFS ) Open (name string ) (fs.File , error ) {
115- return m .OpenFunc (name )
116- }
Original file line number Diff line number Diff line change @@ -11,11 +11,18 @@ import (
1111 "testing"
1212
1313 "github.com/cybertec-postgresql/pgwatch/v3/internal/metrics"
14- "github.com/cybertec-postgresql/pgwatch/v3/internal/testutil"
1514 "github.com/sirupsen/logrus"
1615 "github.com/stretchr/testify/assert"
1716)
1817
18+ type mockFS struct {
19+ OpenFunc func (name string ) (fs.File , error )
20+ }
21+
22+ func (m mockFS ) Open (name string ) (fs.File , error ) {
23+ return m .OpenFunc (name )
24+ }
25+
1926
2027func TestServer_handleStatic (t * testing.T ) {
2128 tempFile := path .Join (t .TempDir (), "file.ext" )
@@ -27,7 +34,7 @@ func TestServer_handleStatic(t *testing.T) {
2734 origUIFS := uiFS
2835 defer func () { uiFS = origUIFS }()
2936
30- uiFS = testutil. MockFS {
37+ uiFS = mockFS {
3138 OpenFunc : func (name string ) (fs.File , error ) {
3239 switch name {
3340 case "index.html" , "static/file.ext" :
You can’t perform that action at this time.
0 commit comments