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 (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"os"
|
"os"
|
||||||
|
@ -23,9 +22,8 @@ func PerformRequest(r http.Handler, method, path string) *httptest.ResponseRecor
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEmptyDirectory(t *testing.T) {
|
func TestEmptyDirectory(t *testing.T) {
|
||||||
// SETUP file
|
|
||||||
testRoot, _ := os.Getwd()
|
testRoot, _ := os.Getwd()
|
||||||
f, err := ioutil.TempFile(testRoot, "")
|
f, err := os.CreateTemp(testRoot, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue