Added a JS unit test to check that an error is thrown when the protocol version is incorrect

#1531