test: refactor tests and cleanup imports
- 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>
This commit is contained in:
parent
9f124f7410
commit
6e6360c0c7
|
@ -2,7 +2,6 @@ package static
|
|||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue