{"action":"closed","issue":{"url":"https://api.github.com/repos/dareid/chakram/issues/13","labels_url":"https://api.github.com/repos/dareid/chakram/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/dareid/chakram/issues/13/comments","events_url":"https://api.github.com/repos/dareid/chakram/issues/13/events","html_url":"https://github.com/dareid/chakram/issues/13","id":84409409,"number":13,"title":"[Question] Is it possible to still use the done callback of mocha in it blocks?","user":{"login":"basco-johnkevin","id":2178576,"avatar_url":"https://avatars.githubusercontent.com/u/2178576?v=3","gravatar_id":"","url":"https://api.github.com/users/basco-johnkevin","html_url":"https://github.com/basco-johnkevin","followers_url":"https://api.github.com/users/basco-johnkevin/followers","following_url":"https://api.github.com/users/basco-johnkevin/following{/other_user}","gists_url":"https://api.github.com/users/basco-johnkevin/gists{/gist_id}","starred_url":"https://api.github.com/users/basco-johnkevin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/basco-johnkevin/subscriptions","organizations_url":"https://api.github.com/users/basco-johnkevin/orgs","repos_url":"https://api.github.com/users/basco-johnkevin/repos","events_url":"https://api.github.com/users/basco-johnkevin/events{/privacy}","received_events_url":"https://api.github.com/users/basco-johnkevin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-06-03T07:22:38Z","updated_at":"2015-09-15T07:29:24Z","closed_at":"2015-09-15T07:29:24Z","body":"I wonder how could I test a code the uses callbacks instead of promises like below:\r\n```\r\ndescribe('with valid params', function() {\r\n  it('should create a ticket', function () {\r\n\r\n    // ... removed code\r\n\r\n    return chakram\r\n      .post(API_URL + '/tickets/', payload, options)\r\n      .then(function(response) {\r\n\r\n        // check that the ticket has been saved to the db\r\n        Ticket.find({where: {id: 1}}, function() {\r\n          expect(ticket.subject).to.equal(payload.subject);\r\n        });\r\n      });\r\n  });\r\n});\r\n```\r\nThe test above will always pass even if it doesn't meet this expectation `expect(ticket.subject).to.equal(payload.subject);` .\r\n\r\nI tried changing it to: `expect(ticket.subject).to.equal('notTheExpectedSubject');` and it still passes. If using the done() callback is possible, I can just add it below the expectation. I tried it but for some reason the test becomes flaky.\r\n\r\nUsing promises works and its not flaky:\r\n```\r\nreturn Ticket.find({\r\n  where: {\r\n    id: 1\r\n  }\r\n}).then(function(ticket) {\r\n  expect(ticket.subject).to.equal(payload.subject);\r\n});\r\n```\r\n\r\nI'm curious how to make it work using callbacks though."}}