Andrew Malta
Andrew Malta

Reputation: 850

Jasmine test always passing

I am running into some weird trouble while trying to write a basic jasmine test to ensure my server is doing what is expected. The server is a typical nodejs/express app.

var request = require('request');
var server = require("../src/js/server-app.js");
var url = "http://localhost:5000/";

describe("server", function() {
  it('succesfully GETs the front page', function() {
    request.get(url, function(error, response, body) {
      expect(response.statusCode).toBe(500);
      done();
    });
  });
});

regardless of what I put in my expect (even expect(0).toBe(1)), my test passes and I'm having trouble figuring out why that is the case.

Thank you guys in advance for the help.

Upvotes: 1

Views: 752

Answers (1)

jacobmassey
jacobmassey

Reputation: 26

You're attempting to use done as a callback, but you aren't specifying any arguments in it. Try the following:

it('successfully GETs the front page', function(done) {
  ...
  done();
}

Upvotes: 1

Related Questions