Android app (TWA) in android/, built with podman; serve assetlinks.json for it
This commit is contained in:
parent
44708d5f3c
commit
7900bf5b3e
21 changed files with 313 additions and 0 deletions
|
|
@ -44,3 +44,19 @@ func TestPWA(t *testing.T) {
|
|||
}
|
||||
get("/static/offline.html")
|
||||
}
|
||||
|
||||
func TestAssetLinks(t *testing.T) {
|
||||
serve := func(cfg Config) *httptest.ResponseRecorder {
|
||||
rec := httptest.NewRecorder()
|
||||
(&Server{cfg: cfg, site: defaultSite()}).Handler().ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "/.well-known/assetlinks.json", nil))
|
||||
return rec
|
||||
}
|
||||
if rec := serve(Config{AndroidCerts: []string{""}}); rec.Code != http.StatusNotFound {
|
||||
t.Errorf("unset: status %d", rec.Code)
|
||||
}
|
||||
rec := serve(Config{AndroidPackage: "sh.zio.cs2", AndroidCerts: []string{" aa:bb ", "", "CC:DD"}})
|
||||
want := `[{"relation":["delegate_permission/common.handle_all_urls"],"target":{"namespace":"android_app","package_name":"sh.zio.cs2","sha256_cert_fingerprints":["AA:BB","CC:DD"]}}]`
|
||||
if got := strings.TrimSpace(rec.Body.String()); rec.Code != http.StatusOK || got != want {
|
||||
t.Errorf("status %d, body %s", rec.Code, got)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue