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
1 answer

TypeError: Cannot read property 'post' of undefined

I m using express and should and i m trying to make calls to the endpoints of my server(app.js) to test the results. My server file (app.js) : app.post('/customer', authorize({allowedPowerLevel: 50}), function(request, response, callback) { const…
Alex Lemesios
  • 522
  • 9
  • 22
0
votes
1 answer

Why is my mocha/should Array throwing test failing?

The following code snippet is very simple (from https://mochajs.org/#synchronous-code). It feels stupidbut, why does [1,2,3] evaluates to undefined when used with literal notation, and not when used in a myArray variable? var assert =…
Carlos Araya
  • 861
  • 2
  • 10
  • 17
0
votes
0 answers

babel-plugin-rewire breaks should.js import?

I encountered a weird problem when trying to use babel-plugin-rewireand should.js assertion library in my tests. With my current configuration I cannot require should to a variable: const should = require('should') console.log('should through…
ronkot
  • 5,915
  • 4
  • 27
  • 41
0
votes
1 answer

Un-requiring node ShouldJS

My node app has a fairly large test suite that depends on ShouldJS module. The problem is that the library blocks assigning .should properties on objects, but my test suite needs to spin up a server that needs to be mockable (i.e. run in the same…
sakovias
  • 1,356
  • 1
  • 17
  • 26
0
votes
1 answer

How to fix mocha error formatting in async assertion

I am trying to set up testing in-browser using Mocha 2.4.5 and Should.js 8.3.0. Failing Should assertions display a useful test failure reason. However, when that same assertion is made in the context of a jQuery Ajax callback, I get an Uncaught…
Silver Solver
  • 2,310
  • 1
  • 13
  • 19
0
votes
1 answer

Should.js - Inconsistency in equals method should.equals

I'm using the should.js framework (v8.2.x) to unit test and have been playing around with some very basic tests. However, I ran into this issue with the tests failing, which has stumped me. I defined this dummy function to test, add: var add =…
0
votes
1 answer

How to return test status - "fail" by should.js?

I using Nightwatch, Mocha and Should.js for testing. And in some cases I do check for text value of elements. My question is - How to make test status - "fail", when text value is not equals to expected value? it("Test should return 'fail'…
Arsenowitch
  • 401
  • 5
  • 22
0
votes
1 answer

mocha returns a promise, false positive passes, and throws exception indicating error

I'm writing unit tests using Mocha and shouldjs, and bluebird. According to the documentation (http://shouldjs.github.io/#assertion-finally) I should be able to return a Promise, and get it tested. It is being run, but not tested. An assertion is…
0
votes
2 answers

Expect array to be array

Writing some tests and ran across an error. The array's seem the same to me, but apparently not. This is the error I'm getting. Any idea on what to do to fix it? Expected Array [ 'A2T1511300361', 'A2T1511300362' ] to be Array [ 'A2T1511300361',…
Justin Young
  • 2,393
  • 3
  • 36
  • 62
0
votes
1 answer

unit testing help- node mocha should

I've been trying to teach myself how to unit test my code since I'm having trouble figuring out where my errors are being generated at times. Here is a simple function that I'm testing- var exports = module.exports = {}; exports.mike =…
Jimbo
  • 81
  • 2
  • 9
0
votes
1 answer

Extending should.js with a custom function

I've got a simple lodash mixin: var _ = require('lodash') _.mixin(require('lodash-uuid')) Which I can use in code like so: if (_.isUuid(someValue)) { // it's a uuid! } I'd like to be able to extend should.js-based tests to leverage this module,…
brandonscript
  • 68,675
  • 32
  • 163
  • 220
0
votes
1 answer

How to assert that Set contains the required values with should.js?

I am using the should.js library for assertions in my unit tests and was wondering how I would go about asserting that the contents of a Set matches the expectation. let actualValues = new…
Lea Hayes
  • 62,536
  • 16
  • 62
  • 111
0
votes
1 answer

Use Shouldjs with Bluebird to test Promises

How do I use Shouldjs to test Promises, with Bluebird? var should = require('should'); var Promise = require('bluebird'); Promise.reject().should.be.fulfilled(); > TypeError: Promise.reject(...).should.be.fulfilled is not a function Bluebird…
Markus Hedlund
  • 23,374
  • 22
  • 80
  • 109
0
votes
0 answers

How to use Should.JS with Chai

I would like to use custom error message with Should.JS and while searching for solutions I came across this answer Apparently should does not support custom error messages at the moment Currently I have been using Should.js version 3.3.2 and my…
David Cruwys
  • 6,262
  • 12
  • 45
  • 91
0
votes
1 answer

WebStorm 10: list of typescript community stubs truncated

I'm using Should.js and I'd like to get some auto-completion for it. Unfortunately WebStorm is not showing all the TypeScript community stubs. Just like in the DefinitelyTyped GitHub page the list is truncated to show the first 1000 files only. At…
Aetherix
  • 2,150
  • 3
  • 24
  • 44