aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


server/e2e_absent_test.go (677B)


      1 //go:build !e2e
      2 
      3 package main
      4 
      5 import (
      6 	"net/http"
      7 	"net/http/httptest"
      8 	"testing"
      9 )
     10 
     11 func TestProductionOmitsBrowserSetupAPI(t *testing.T) {
     12 	world := newTestServer(t)
     13 	for _, request := range []*http.Request{
     14 		httptest.NewRequest("POST", "/_test/visitor", nil),
     15 		httptest.NewRequest("GET", "/_test/player", nil),
     16 		httptest.NewRequest("POST", "/_test/player/progress", nil),
     17 		httptest.NewRequest("POST", "/_test/player/grant-item", nil),
     18 	} {
     19 		response := httptest.NewRecorder()
     20 		world.httpHandler().ServeHTTP(response, request)
     21 		if response.Code != http.StatusNotFound {
     22 			t.Fatal("production exposed a browser test route", request.URL.Path, response.Code)
     23 		}
     24 	}
     25 }