@@ -29,4 +29,40 @@ public function an_url_can_be_updated()
2929
3030 $ this ->assertEquals ($ response ['url ' ], $ url ['url ' ]);
3131 }
32+
33+ /** @test */
34+ public function an_extension_could_be_blacklisted_on_update ()
35+ {
36+ \Config::set ('shorturl.blacklist ' , '.test ' );
37+
38+ $ url = array_merge ($ this ->createUrl (), ['url ' => 'https://laravel.test ' ]);
39+
40+ $ response = $ this ->putJson (route ('shorturl.url.update ' , ['id ' => $ url ['id ' ]]), $ url )->json ();
41+
42+ $ this ->assertArrayHasKey ('url ' , $ response ['errors ' ]);
43+ }
44+
45+ /** @test */
46+ public function a_keyword_could_be_blacklisted_on_update ()
47+ {
48+ \Config::set ('shorturl.blacklist ' , 'test ' );
49+
50+ $ url = array_merge ($ this ->createUrl (), ['url ' => 'https://test.com ' ]);
51+
52+ $ response = $ this ->putJson (route ('shorturl.url.update ' , ['id ' => $ url ['id ' ]]), $ url )->json ();
53+
54+ $ this ->assertArrayHasKey ('url ' , $ response ['errors ' ]);
55+ }
56+
57+ /** @test */
58+ public function an_url_could_be_blacklisted_on_update ()
59+ {
60+ \Config::set ('shorturl.blacklist ' , '//test.com ' );
61+
62+ $ url = array_merge ($ this ->createUrl (), ['url ' => 'https://test.com ' ]);
63+
64+ $ response = $ this ->putJson (route ('shorturl.url.update ' , ['id ' => $ url ['id ' ]]), $ url )->json ();
65+
66+ $ this ->assertArrayHasKey ('url ' , $ response ['errors ' ]);
67+ }
3268}
0 commit comments