samedi 5 septembre 2015

Mocha testing: 'TypeError: undefined not a function' at Test.serverAddress

I have the following test:

describe('Testing the GET methods', function() {
    it('Should be able to get the list of articles', function(done) {
      // Create a SuperTest request
      request(app).get('/api/articles/')
          .set('Accept', 'application/json')
          .expect('Content-Type', /json/)
          .expect(200)
          .end(function(err, res) {
              res.body.should.be.an.Array.and.have.lengthOf(1);
              res.body[0].should.have.property('title', article.title);
              res.body[0].should.have.property('content', article.content);

              done();
      });
    });

    it('Should be able to get the specific article', function(done) {
      // Create a SuperTest request
      request(app).get('/api/articles/' + article.id)
          .set('Accept', 'application/json')
          .expect('Content-Type', /json/)
          .expect(200)
          .end(function(err, res) {
              res.body.should.be.an.Object.and.have.property('title', article.title);
              res.body.should.have.property('content', article.content);

              done();
      });
    });
  });

Which produces this following error: enter image description here

any ideas what might be the issue? I have all dependencies checked and installed and required.

Aucun commentaire:

Enregistrer un commentaire