@@ -15,14 +15,15 @@ public function testIndex()
1515 $ response = $ this ->get ('help ' );
1616
1717 $ response ->assertOK ();
18- $ response ->assertSee ('Help Section ' , 'h1 ' );
18+ $ response ->assertSee ('Help ' , 'h1 ' );
1919 }
2020
2121 public function testIndexSearch ()
2222 {
2323 $ response = $ this
2424 ->withHeaders ([
2525 csrf_header () => csrf_hash (),
26+ 'REFERER ' => url_to ('pages ' ),
2627 ])
2728 ->post ('help ' , [
2829 'search ' => 'sample ' ,
@@ -32,6 +33,22 @@ public function testIndexSearch()
3233 $ response ->assertSee ('Search Results ' , 'h3 ' );
3334 }
3435
36+ public function testIndexSearchWithoutReferrer ()
37+ {
38+ $ response = $ this
39+ ->withHeaders ([
40+ csrf_header () => csrf_hash (),
41+ 'REFERER ' => '' ,
42+ 'HX-Request ' => 'true ' ,
43+ ])
44+ ->post ('help ' , [
45+ 'search ' => 'sample ' ,
46+ ]);
47+
48+ $ this ->assertSame (200 , $ response ->response ()->getStatusCode ());
49+ $ this ->assertEmpty ($ response ->response ()->getBody ());
50+ }
51+
3552 public function testIndexSearchEmpty ()
3653 {
3754 $ response = $ this
@@ -45,6 +62,7 @@ public function testIndexSearchEmpty()
4562 ]);
4663
4764 $ response ->assertStatus (200 );
65+ $ response ->assertSee ('The search field may only contain alphanumeric and space characters. ' , 'span ' );
4866 }
4967
5068 public function testIndexSearchValidationError ()
@@ -56,7 +74,7 @@ public function testIndexSearchValidationError()
5674 csrf_header () => csrf_hash (),
5775 ])
5876 ->post ('help ' , [
59- 'search ' => 'sam ' ,
77+ 'search ' => ' sam ' ,
6078 ]);
6179
6280 $ response ->assertOK ();
@@ -68,6 +86,7 @@ public function testIndexSearchNoResults()
6886 $ response = $ this
6987 ->withHeaders ([
7088 csrf_header () => csrf_hash (),
89+ 'REFERER ' => url_to ('pages ' ),
7190 ])
7291 ->post ('help ' , [
7392 'search ' => 'invalid ' ,
0 commit comments