Quality Assurance Projects - Issue Tracker. "All 14 functional tests are complete and passing." fail

Tell us what’s happening:
Hi all, I am passing all the tests except the last one. I am pretty sure I am doing something wrong/different than the tests expect, but I cannot figure out what exactly. The tests pass, they show up as passed here as well /_api/get-tests (I tried to get some info by looking at the network requests via the developer tools in chrome)

Your code so far
My test code is here - https://repl.it/@Aigarsss/boilerplate-project-issuetracker

Example of the first test:

  test('Create an issue with every field: POST request to /api/issues/{project}', function(done) {
    chai.request(server)
    .post("/api/issues/apitest")
    .set('content-type', 'application/json')
    .send({
      issue_title: "ToDelete",
      issue_text: "issueText",
      created_by: "createdBy",
      assigned_to: "assignedTo",
      status_text: "statusText" 
      })
    .end(function(error, res){
      res.should.have.status(200)
      res.body.should.have.property("_id")
      //https://www.digitalocean.com/community/tutorials/test-a-node-restful-api-with-mocha-and-chai
      done();
    });
  });

I am not sure how to trouble shoot this, as obviously I could just pass the tests by just doing “done” in all of them, so I assume FCC checks are looking for specific things there?

When I submit, this is what I get in the console: At least one assertion per test: expected 0 to be at least 1

This part might not be correct, but I am not sure how to correctly write it:

  test('Delete an issue: DELETE request to /api/issues/{project}', async function() {
  
    const toDelete = await Issue.findOne({issue_title: "ToDelete"}).exec()

    chai.request(server)
    .delete("/api/issues/apitest")
    .send({_id: toDelete._id}) // how to generate new id every time?
    .end(function(error, res){
      res.body.should.have.property("result").eql("successfully deleted")
       //done(); //https://stackoverflow.com/questions/41761683/why-am-i-getting-error-resolution-method-is-overspecified
    });
  });

And one last thing, when I run the FCC tests, i get “undefined” in the repl console. I looked at other FCC posts, seems like for other people it was caused by calling “done()” outside of .end, but it doesn’t seem to be the case here.

Challenge: Issue Tracker

Link to the challenge:

Okay, I think I got it. Looking at the network response:
{“title”:“Create an issue with every field: POST request to /api/issues/project”,“context”:" → Functional Tests",“state”:“passed”,“assertions”:}

Assertions array is empty, so it probably expects that I will use the chai assert, rather than any other test. Will check.

Hey there,

Unfortuantely, this does appear to be the case. Here is the code in the assertion-analyser.js:

let splittedAssertions = s.str.split('assert');
let assertions = splittedAssertions.slice(1);

So, my understanding would be that it expects chai assertions to be used directly. Props, for learning another testing library (built in), though.

1 Like

Thanks again Sky020.

That’s exactly what the problem was, had to use assert. Here is the first example re-written, in case anyone else bumps into this.


  test('Create an issue with every field: POST request to /api/issues/project', function(done) {
    chai.request(server)
    .post("/api/issues/apitest")
    .set('content-type', 'application/json')
    .send({
      issue_title: "ToDelete",
      issue_text: "issueText",
      created_by: "createdBy",
      assigned_to: "assignedTo",
      status_text: "statusText" 
      })
    .end(function(error, res){
      assert.equal(res.body.issue_title, "ToDelete")
      done();
    });
  });