wrote test for $test.matches

Imporved escaping strings by using JSON.stringify when sending request
and escaping the message in the tests