Unit test for pattern.js