feat: Bundle assets in binary using go:embed (#340)

Fixes #47
This commit is contained in:
TwiN
2022-10-09 21:33:31 -04:00
committed by GitHub
parent 47dd18a0b5
commit 00b56ecefd
16 changed files with 135 additions and 83 deletions

View File

@ -9,7 +9,7 @@ import (
)
func TestCreateRouter(t *testing.T) {
router := CreateRouter("../../web/static", &config.Config{Metrics: true})
router := CreateRouter(&config.Config{Metrics: true})
type Scenario struct {
Name string
Path string
@ -28,16 +28,32 @@ func TestCreateRouter(t *testing.T) {
ExpectedCode: http.StatusOK,
},
{
Name: "scripts",
Name: "favicon.ico",
Path: "/favicon.ico",
ExpectedCode: http.StatusOK,
},
{
Name: "app.js",
Path: "/js/app.js",
ExpectedCode: http.StatusOK,
},
{
Name: "scripts-gzipped",
Name: "app.js-gzipped",
Path: "/js/app.js",
ExpectedCode: http.StatusOK,
Gzip: true,
},
{
Name: "chunk-vendors.js",
Path: "/js/chunk-vendors.js",
ExpectedCode: http.StatusOK,
},
{
Name: "chunk-vendors.js-gzipped",
Path: "/js/chunk-vendors.js",
ExpectedCode: http.StatusOK,
Gzip: true,
},
{
Name: "index-redirect",
Path: "/index.html",