Changed tester command from 'make test' to 'make tester'

This commit is contained in:
2025-02-12 17:35:57 +11:00
parent 1253c6499d
commit ca92d573ba
3 changed files with 8 additions and 6 deletions

View File

@@ -14,7 +14,7 @@ dev:
air &\ air &\
tailwindcss -i ./static/css/input.css -o ./static/css/output.css --watch tailwindcss -i ./static/css/input.css -o ./static/css/output.css --watch
test: tester:
go mod tidy && \ go mod tidy && \
go run . --port 3232 --test --loglevel trace go run . --port 3232 --test --loglevel trace

View File

@@ -21,10 +21,10 @@ func addRoutes(
// Static files // Static files
mux.Handle("GET /static/", http.StripPrefix("/static/", handlers.HandleStatic())) mux.Handle("GET /static/", http.StripPrefix("/static/", handlers.HandleStatic()))
// Index page // Index page and unhandled catchall (404)
mux.Handle("GET /", handlers.HandleRoot()) mux.Handle("GET /", handlers.HandleRoot())
// Static pages // Static content, unprotected pages
mux.Handle("GET /about", handlers.HandlePage(page.About())) mux.Handle("GET /about", handlers.HandlePage(page.About()))
// Login page and handlers // Login page and handlers
@@ -35,4 +35,6 @@ func addRoutes(
conn, conn,
config.SecretKey, config.SecretKey,
)) ))
// Profile page
} }

View File

@@ -4,19 +4,19 @@ import (
"database/sql" "database/sql"
"net/http" "net/http"
"projectreshoot/server" "projectreshoot/config"
"github.com/rs/zerolog" "github.com/rs/zerolog"
) )
// This function will only be called if the --test commandline flag is set. // This function will only be called if the --test commandline flag is set.
// After the function finishes the application will close. // After the function finishes the application will close.
// Running command `make test` will run the test using port 3232 to avoid // Running command `make tester` will run the test using port 3232 to avoid
// conflicts on the default 3333. Useful for testing things out during dev. // conflicts on the default 3333. Useful for testing things out during dev.
// If you add code here, remember to run: // If you add code here, remember to run:
// `git update-index --assume-unchanged tester.go` to avoid tracking changes // `git update-index --assume-unchanged tester.go` to avoid tracking changes
func test( func test(
config *server.Config, config *config.Config,
logger *zerolog.Logger, logger *zerolog.Logger,
conn *sql.DB, conn *sql.DB,
srv *http.Server, srv *http.Server,