I tried it on a functional model and change the function exists not know
dependencies": {
"express": "^4.14.0",
"cors": "^2.8.1",
"body-parser": "^1.15.2",
"chai": "^3.5.0",
"mongodb": "^3.1.3",
"chai-http": "^3.0.0",
"mocha": "^3.2.0",
"zombie": "^5.0.5",
"helmet": "^3.1.0",
"mongoose": "^5.2.8",
"x-xss-protection": "^1.1.0"
},
test('Every field filled in', function(done) { chai.request(server) .post('/api/issues/test') .send({ issue_title: title, issue_text: 'text', created_by: 'Functional Test - Every field filled in', assigned_to: 'Chai and Mocha', status_text: 'In QA' }) .end(function(err, res){ if(err) console.log( err); assert.equal(res.status, 200); // console.log( res.body.issue_text); // console.log( "re"+JSON.stringify( res)); assert.isDefined(res.body.issue_title,title); assert.exists(res.body.issue_text,'text'); assert.equal(res.body.created_by,'Functional Test - Every field filled in'); assert.equal(res.body.assigned_to,'Chai and Mocha'); assert.equal(res.body.status_text,'In QA'); idtest=res.body._id done(); });
Hey @lubodrinka thanks for this issue!
Check to make sure you're doing const {assert} = require('chai'). node.js comes with an assert package by default, but it does not include all of the chai funtionality. You need to manually include chai's assert like above.
Thank you for your time in reporting this. I'm going to close this, because it is not a bug within chai. If you do find any bugs please don't hesitate to report them in future 馃槃
this is worse than previous
var chaiHttp = require('chai-http');
var chai = require('chai');
const {assert} = require('chai')
var server = require('../server');
var idtest;
var title='Title1'+ new Date()
chai.use(chaiHttp);
Hi @lubodrinka. assert.exists wasn't released until Chai v4.0.
So, it,s bug: https://www.chaijs.com/api/assert/ , I even dont know whati is actual version.
Is there problem to each function write (from version 4.0)?
Please see https://github.com/chaijs/chaijs.github.io/issues/178 which is an issue that plans to reflect version numbers for this stuff.
Hey this os nonsense, nobody look in there, nobody. rewrite the manual.
@lubodrinka Chai is an open source project maintained by unpaid volunteers, that relies on the contributions of other unpaid volunteers. Currently the documentation only reflects the latest version of Chai (v4.2.0), but as @keithamus mentioned, a volunteer in https://github.com/chaijs/chaijs.github.io/issues/178 has offered to improve the website so that the docs for older versions of Chai are available as well.
Do you have a requirement to use Chai v3.5.0 even though it's 2+ years old and unmaintained? If not, then I suggest upgrading to Chai v4.2.0, in which case you'll be able to use chai.asserts and the docs will match the API.
Oh god you are lazy man.
Let assume use 4.0. and you don't have somewhere that must be with new declarations in brackets.
So if somebody try that oh that not working so rather use 3.5 version.
there is tons of prefabricated solutions or done with 3.5 and someone want add another function ..
I don't even believe I must tell you.
@lubodrinka participation in the chai issue tracker is dependant on our Code of Conduct. Please read it and adhere to it.