Strange behaviour - noobling/Homefornow GitHub Wiki

Testing

Sessions are not maintained with supertest so we have to create our own by getting and setting cookies. We could use an alternative library such as chai http and super agent that supposedly maintains sessions but for some reason they do not wait for the db to connect and run the tests immediately causing the tests to fail. Therefore we login a user every time and get their cookie then the subsequent test uses this cookie to maintain a user session. However the same user cannot be used in another test for some reason. This means that the cookie for that user doesn't work for any other tests other than its subsequent test so we have to login a new user each time for every new test. You will see in our test code every time a user is logged in it will be a unique user e.g. users[0] then users[1] and so on. Therefore if you want to test a new feature make sure that, the user you are using to login has not been used before.

Babel

No idea why but it causes an error when it transpiles the service.js file with a for of loop in it.