fix logic error in tests.js