My experience with jasmine testing has been successful when done locally. However, I am encountering issues on Travis CI where all the API tests are returning undefined values. Here is an example:
4) Checking Server Status for GET /api/v1/orders - Expected 200 Message: The value returned was expected to be 200 but instead it was undefined. Stack: Error: The value returned was expected to be 200 but instead it was undefined. at
Here is a snippet from the test cases:
describe('GET /api/v1/orders', function () {
var data = {};
beforeAll(function (done) {
Request.get('http://localhost:3001/api/v1/orders', function (error, response, body) {
data.status = response.statusCode;
data.body = JSON.parse(body);
data.number = data.body.length;
done();
});
});
it('Should have a status of 200', function () {
expect(data.status).toBe(200);
});
it('Expected return of three Items', function () {
expect(data.number).toBe(3);
});
});
Could the issue possibly stem from the 'http://localhost:3001/api/v1/orders' URL?