Questions tagged [should.js]

should is an expressive, readable, test framework agnostic, assertion library for node.

should is an expressive, readable, test framework agnostic, assertion library for node.

GitHub project: https://github.com/visionmedia/should.js

API reference: http://shouldjs.github.io/

149 questions
0
votes
0 answers

mocha test timeout fail insted of assertion fail

When runing the following test I expect to recive fail AssertionError: expected {} to have key 'key'missing keys: 'key' but insted I get: Error: timeout of 5000ms exceeded. Ensure the done() callback is being called in this test. the…
Muffasa
  • 218
  • 4
  • 12
0
votes
1 answer

should js assertion is wrong?

I'm using should.js && mocha as test framework to build an application. I'm returning 'true' for an API method and I found out that should.js was accepting everything as true, which is not. I set up the following test: describe('Login',…
wOvalle
  • 87
  • 9
0
votes
0 answers

mocha+shouldjs Object Assertion has no method 'indexOf'

I'm using mochajs + should-promised as testing framework. I'm trying to test an bluebird promise and I get Unhandled rejection TypeError: Object # has no method 'indexOf' at Assertion. ([app…
wOvalle
  • 87
  • 9
0
votes
1 answer

Testing for duplication with Mongoose and Mocha

I have the following scenario, my model with the following schema var MySchema = new Schema({ name: {type: String, required: true, unique: true} }) var MyModel = mongoose.model('MyModel', MySchema) And the following tests (I'm sorry it's long,…
fixmycode
  • 8,220
  • 2
  • 28
  • 43
0
votes
2 answers

Assertion for http header

Im doing some Unit testing to node application and I check for http response. currnlty I want to test also the http.header response for key and value which I send,what am I doing wrong ? res.header.should.have.property['prop1']; Assume that I've…
John Jerrby
  • 1,683
  • 7
  • 31
  • 68
0
votes
1 answer

Run test are not running as expected

I run the following test and its not stopping in the actions of the express router The URL is exactly the url which I put in postman and works ,any idea? describe('test', function () { it('Should Run///', function (done) { …
user4445419
0
votes
1 answer

karma + mocha + should v7 not working - should is undefined

I am trying to configure karma + mocha + should but I must be missing something since should is undefined in my tests. According to the plugin documentation, the only steps to follow are: 1.- Add should to frameworks and karma-should to plugins…
codependent
  • 23,193
  • 31
  • 166
  • 308
0
votes
1 answer

Asserting all array elements are objects

How can I assert that all elements of list are objects? should.exist(list) list.should.be.an('array') ... // ?
hellboy
  • 1,567
  • 6
  • 21
  • 54
0
votes
1 answer

Should.js throwing JSHint warnings

I'm using should.js for assertions, however, I am getting JSHint warnings for: argObject.exists(dummyString1).should.be.true; argObject.exists(dummyString2).should.be.true; is throwing Expected an assignment or function call and instead saw an…
BanksySan
  • 27,362
  • 33
  • 117
  • 216
0
votes
1 answer

How do I explicitly fail a unit test using should.js

I'm using Mocha and Should.js to test a promise that I am expecting to generate an error. Because it is a promise, I don't believe I can simply use should.throwError(). This just means that I would like to fail the unit test in the .catch block of…
slifty
  • 13,062
  • 13
  • 71
  • 109
0
votes
1 answer

Issue with mocha tests with should.js

I have the following code (mocha test with should.js): it('must not be valid with empty object', function (done) { var result = {}; result.should.not.be.object; }); It passes, although result is an object. It also with passes…
fastcodejava
  • 39,895
  • 28
  • 133
  • 186
0
votes
1 answer

Use AND/OR with Should.js (supertest)

I need you to know how i can use AND/OR with should.js I try to do something like that : res.body[0].color.should.equal('blue').or('red'); It is possible with should ? I find nothing in documentation..Or i'm blind. Thanks in advance.
Charly
  • 125
  • 8
0
votes
1 answer

why is this test failing on node.js with should and mocha?

'use strict'; var should = require('should'); describe('wtf', function () { it('compare arrays', function (done) { [].should.equal([]); }); }); My tests were working fine until I switched from node 10.26 installed from brew to nvm…
chovy
  • 72,281
  • 52
  • 227
  • 295
0
votes
1 answer

Testing Angular with Mocha returning error

I installed Mocha and Shouldjs using npm install -g mocha npm install -g should to test my Angular app. I copied a test from here, which reads as follows: describe('addition', function () { it('should add 1+1 correctly', function (done) { var…
CodyBugstein
  • 21,984
  • 61
  • 207
  • 363
0
votes
1 answer

Using shouldjs to check values in an unordered array

I have an express.js application where I am using supertest and should.js for my testing framework. I'm having trouble testing for values in an unordered array. According to the should.js documentation, the .any function would work here. Any…
Michael Merchant
  • 1,509
  • 2
  • 17
  • 28
1 2 3
9
10