[DEPRECATED] Go implementation of plcbundle
at main 31 lines 677 B view raw
1package server_test 2 3import ( 4 "io" 5 "net/http" 6 "net/http/httptest" 7 "testing" 8) 9 10func TestServerHelperFunctions(t *testing.T) { 11 // Note: Many helper functions are unexported, so we test them indirectly 12 13 t.Run("FormatNumber_ViaOutput", func(t *testing.T) { 14 // This tests the formatNumber function indirectly 15 srv, _, cleanup := setupTestServer(t, false) 16 defer cleanup() 17 18 ts := httptest.NewServer(srv) 19 defer ts.Close() 20 21 resp, _ := http.Get(ts.URL + "/") 22 body, _ := io.ReadAll(resp.Body) 23 resp.Body.Close() 24 25 // Large numbers should be formatted with commas 26 // Check if output looks reasonable 27 if len(body) == 0 { 28 t.Error("root page is empty") 29 } 30 }) 31}