Fix DeckCraft WASM startup and prefer built-in file previews
This commit is contained in:
1 parent
852140c3a7
commit
7371c29111
21 files changed
+275
-15
No files matched your search
@@ -243,6 +243,36 @@ func TestOfficeBridgeDelivery(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeckCraftCompatOnlyForKnownBuild(t *testing.T) {
|
||||
manager := installedTestManager(t)
|
||||
key := []byte("deck-compat-route")
|
||||
perm := users.Permissions{Download: true, Modify: true}
|
||||
store := scopedUserStorage(t, t.TempDir(), perm, key)
|
||||
handler := handle(addonStaticHandler(manager), "", store, &settings.Server{})
|
||||
for _, build := range []string{"v0.9.0-38076027b9c1", "v0.9.0-unknown", "v0.10.0-future"} {
|
||||
dir := filepath.Join(manager.Root, "deckcraft", "versions", build)
|
||||
if err := os.MkdirAll(dir, 0750); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.WriteFile(filepath.Join(dir, "index.html"), []byte("index"), 0600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
r := httptest.NewRequest("GET", "/addons/deckcraft/"+build+"/filebrowser-bridge.js", nil)
|
||||
r = mux.SetURLVars(r, map[string]string{"addon": "deckcraft", "build": build, "asset": "filebrowser-bridge.js"})
|
||||
rec := httptest.NewRecorder()
|
||||
handler.ServeHTTP(rec, authorizeTestRequest(r, signToken(t, perm, key)))
|
||||
if rec.Code != 200 {
|
||||
t.Fatalf("bridge %s: %d", build, rec.Code)
|
||||
}
|
||||
if bytes.Contains(rec.Body.Bytes(), deckcraftCompat) != (build == "v0.9.0-38076027b9c1") {
|
||||
t.Fatalf("wrong compat build selection: %s", build)
|
||||
}
|
||||
if !bytes.Contains(rec.Body.Bytes(), officeBridge) {
|
||||
t.Fatal("missing file adapter")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestOfficeArchiveLimitsWithoutInflating(t *testing.T) {
|
||||
valid, err := blankCraftDocument("wordcraft")
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user