@@ -379,8 +379,10 @@ func TestEditFormDropsMalformedTrail(t *testing.T) {
379379 svc := & fakeReading {draft : domain.EditDraft {Path : "/x.md" , Version : 3 }}
380380 rec := get (authedApp (t , svc ), "/w/root/edit/x.md?trail=junk&tpane=9" )
381381 body := rec .Body .String ()
382- if strings .Contains (body , `name="trail"` ) {
383- t .Errorf ("malformed trail context must not be propagated" )
382+ for _ , absent := range []string {`name="trail"` , `name="tpane"` } {
383+ if strings .Contains (body , absent ) {
384+ t .Errorf ("malformed trail context must not propagate %s" , absent )
385+ }
384386 }
385387 if ! strings .Contains (body , `href="/w/root/d/x.md"` ) {
386388 t .Errorf ("cancel must fall back to the standalone document page" )
@@ -439,6 +441,9 @@ func TestCreateDocAppendsToTrail(t *testing.T) {
439441 "trail" : {"root/d/index.md" }, "tpane" : {"0" },
440442 }
441443 rec := postForm (authedApp (t , svc ), "/w/root/new" , form )
444+ if rec .Code != http .StatusSeeOther {
445+ t .Fatalf ("status = %d, want 303" , rec .Code )
446+ }
442447 if loc := rec .Header ().Get ("Location" ); loc != "/t/root/d/index.md/~/root/d/plans/new.md" {
443448 t .Errorf ("redirect = %q, want the trail with the new doc appended" , loc )
444449 }
@@ -451,6 +456,9 @@ func TestAppendDocReturnsToTrail(t *testing.T) {
451456 "trail" : {"root/d/log.md" }, "tpane" : {"0" },
452457 }
453458 rec := postForm (authedApp (t , svc ), "/w/root/append/log.md" , form )
459+ if rec .Code != http .StatusSeeOther {
460+ t .Fatalf ("status = %d, want 303" , rec .Code )
461+ }
454462 if loc := rec .Header ().Get ("Location" ); loc != "/t/root/d/log.md" {
455463 t .Errorf ("redirect = %q, want the carried trail" , loc )
456464 }
0 commit comments