Add local glTF viewer and visual coverage
Amp-Thread-ID: https://ampcode.com/threads/T-01a02d1c-27fc-7761-9f51-ed97b2dd4e3e Co-authored-by: Heaust Azure <heaust.azure@gmail.com>
This commit is contained in:
@@ -144,3 +144,24 @@ func TestSavedPlaygroundPageRoute(t *testing.T) {
|
||||
t.Fatalf("content type = %q", contentType)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGltfViewerPageRoute(t *testing.T) {
|
||||
request := httptest.NewRequest(http.MethodGet, "/view/gltf", nil)
|
||||
response := httptest.NewRecorder()
|
||||
testApplication(t).routes().ServeHTTP(response, request)
|
||||
if response.Code != http.StatusOK {
|
||||
t.Fatalf("status = %d", response.Code)
|
||||
}
|
||||
if contentType := response.Header().Get("Content-Type"); contentType != "text/html; charset=utf-8" {
|
||||
t.Fatalf("content type = %q", contentType)
|
||||
}
|
||||
for _, content := range []string{
|
||||
`"@yawn/core": "/pkg/core.js"`,
|
||||
`"@yawn/handles": "/pkg/handles.js"`,
|
||||
"Drop a glTF file",
|
||||
} {
|
||||
if !bytes.Contains(response.Body.Bytes(), []byte(content)) {
|
||||
t.Fatalf("viewer page does not contain %q", content)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user