Commit 8d2d9b18 authored by Luc Didry's avatar Luc Didry

Add unit test for URL trimming

This commit is dedicated to GuilhemB. Thx for supporting me on Tipeee
:-)
parent 5d2def9b
Pipeline #9678 failed with stage
in 4 minutes and 10 seconds
......@@ -102,4 +102,11 @@ $t->post_ok('/a' => form => { lsturl => 'https://lstu.fr', format => 'json' })
->json_is('/success' => false)
->json_like('/msg' => qr#You asked to shorten too many URLs too quickly\. You're banned for \d+ hour\(s\)\.#);
LstuModel::Ban->delete_where('1 = 1'); # Reset banishing
$t->post_ok('/a' => form => { lsturl => ' https://fiat-tux.fr', format => 'json' })
->status_is(200)
->json_has('url', 'short', 'success')
->json_is('/success' => true, '/url' => 'https://fiat-tux.fr')
->json_like('/short' => qr#http://127\.0\.0\.1:\d+/[-_a-zA-Z0-9]{8}#);
done_testing();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment