Refactoring for negative lexer tests in js