test(10-05): cover every Phase 10 Go change with branch-level tests
- bouncer TestPhase10CookieGuard: cookie read without Bearer, Bearer wins, empty cookie, frontend audience and blacklisted jti rejected - boardwalk TestPhase10BoardwalkServing: HEAD, query strings, encoded traversal, index by name, nested prefix, MIME fallback, constructor errors - cabana TestPhase10Coverage: mounted unsafe routes vs the CSRF walk, option and filter edges, read-only labels, relation message defaults, bundle fallback locale, cookie refresh of an expired token in the refresh window - phrasebook override precedence, new locale, Bundle merge order, Forms shapes - surf prefix collision for deeper paths and the default /backend prefix - swagger2openapi TestUnionRewrite and converter branch tests - framework tests no longer name the application (acme fixtures instead)
This commit is contained in:
@@ -229,7 +229,7 @@ func TestFormSchemaRejects(t *testing.T) {
|
||||
{
|
||||
name: "partial path",
|
||||
config: formConfig,
|
||||
fields: "fields:\n editors:\n type: partial\n path: $/golem15/fonoteka/controllers/collections/_editors.htm\n",
|
||||
fields: "fields:\n editors:\n type: partial\n path: $/golem15/acme/controllers/collections/_editors.htm\n",
|
||||
want: []string{"acme.demo", "acme.demo.widgets", "models/widget/fields.yaml", "path"},
|
||||
},
|
||||
{
|
||||
@@ -382,7 +382,7 @@ func TestFormSchemaDropdownOptions(t *testing.T) {
|
||||
schema := mustCompileForm(t, schemaController{model: "Widget"}, formConfig, optionMapYAML)
|
||||
tr := phrasebook.NewTranslator(formCatalog(t), phrasebook.Options{Locale: "pl", Fallback: "en"})
|
||||
got := localizeJSON(t, schema, towel.WithLocale(context.Background(), "pl"), tr, nil)
|
||||
vinyl := strings.Index(got, `{"value":"vinyl","label":"Winyl"}`)
|
||||
vinyl := strings.Index(got, `{"value":"vinyl","label":"Stal"}`)
|
||||
two := strings.Index(got, `{"value":2,"label":"Dwa"}`)
|
||||
yes := strings.Index(got, `{"value":true,"label":"Yes"}`)
|
||||
if vinyl < 0 || two < 0 || yes < 0 || !(vinyl < two && two < yes) {
|
||||
@@ -394,7 +394,7 @@ func TestFormSchemaDropdownOptions(t *testing.T) {
|
||||
|
||||
methodSchema := mustCompileForm(t, providerController{schemaController: schemaController{model: "Widget"}}, formConfig, methodFieldsYAML)
|
||||
methodJSON := localizeJSON(t, methodSchema, towel.WithLocale(context.Background(), "pl"), tr, providerController{})
|
||||
if !strings.Contains(methodJSON, `{"value":"vinyl","label":"Winyl"}`) || !strings.Contains(methodJSON, `{"value":"cd","label":"Płyta"}`) {
|
||||
if !strings.Contains(methodJSON, `{"value":"vinyl","label":"Stal"}`) || !strings.Contains(methodJSON, `{"value":"cd","label":"Drewno"}`) {
|
||||
t.Fatalf("method options = %s", methodJSON)
|
||||
}
|
||||
if strings.Contains(methodJSON, "getFormatOptions") {
|
||||
@@ -407,7 +407,7 @@ func TestFormSchemaDropdownOptions(t *testing.T) {
|
||||
|
||||
modelSchema := mustCompileForm(t, sourceController{schemaController: schemaController{model: "Widget"}, rec: modelOptions{}}, formConfig, "fields:\n format:\n type: dropdown\n options: getFormatOptions\n")
|
||||
modelJSON := localizeJSON(t, modelSchema, towel.WithLocale(context.Background(), "pl"), tr, modelOptions{})
|
||||
if !strings.Contains(modelJSON, `{"value":"lp","label":"Winyl"}`) {
|
||||
if !strings.Contains(modelJSON, `{"value":"lp","label":"Stal"}`) {
|
||||
t.Fatalf("model provider options = %s", modelJSON)
|
||||
}
|
||||
|
||||
@@ -492,7 +492,7 @@ func formCatalog(t *testing.T) *phrasebook.Catalog {
|
||||
cat := phrasebook.NewCatalog()
|
||||
err := cat.Load("acme.demo", fstest.MapFS{
|
||||
"lang/en/lang.yaml": &fstest.MapFile{Data: []byte("form: Form\ntitle: Title\ncomment: Comment\ntab: Tab\nempty: None\nvinyl: Vinyl\ncd: CD\ntwo: Two\n")},
|
||||
"lang/pl/lang.yaml": &fstest.MapFile{Data: []byte("form: Formularz\ntitle: Tytuł\ncomment: Komentarz\ntab: Zakładka\nempty: Brak\nvinyl: Winyl\ncd: Płyta\ntwo: Dwa\n")},
|
||||
"lang/pl/lang.yaml": &fstest.MapFile{Data: []byte("form: Formularz\ntitle: Tytuł\ncomment: Komentarz\ntab: Zakładka\nempty: Brak\nvinyl: Stal\ncd: Drewno\ntwo: Dwa\n")},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("catalog: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user