Skip to content

Commit

Permalink
test: refactor tests and cleanup imports
Browse files Browse the repository at this point in the history
- Replace `ioutil.TempFile` with `os.CreateTemp` in `TestEmptyDirectory` test function
- Remove unused import `io/ioutil` in `serve_test.go`

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
  • Loading branch information
appleboy committed Feb 17, 2024
1 parent 9f124f7 commit 6e6360c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions serve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package static

import (
"context"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
Expand All @@ -23,9 +22,8 @@ func PerformRequest(r http.Handler, method, path string) *httptest.ResponseRecor
}

func TestEmptyDirectory(t *testing.T) {
// SETUP file
testRoot, _ := os.Getwd()
f, err := ioutil.TempFile(testRoot, "")
f, err := os.CreateTemp(testRoot, "")
if err != nil {
t.Error(err)
}
Expand Down

0 comments on commit 6e6360c

Please sign in to comment.