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

NodeJS testing Database with Mocha and should.js

I'm testing my NodeJS application with mocha and should. While the first test runs smoothly the second fails (error equals null). In both tests if got a valid user within the callback (both have the same id in mongoose). The tests obviously don't…
user1772306
  • 449
  • 1
  • 7
  • 20
1
vote
1 answer

Object # has no method 'type'
My test code is var strategy = require('../lib'); var should = require("should"); describe('passport-twitter', function() { it('should export Strategy constructor directly from package', function() { console.log('strategy is',strategy); …
Nitin
  • 171
  • 2
  • 5
1
vote
1 answer

How to check object equality using should.js with a property value as NaN

I believe this is a bug in should.js due to a special value NaN as NaN is not equal to itself. ({ a: 1, c: 3, b: 2, d: NaN }).should.eql({ a: 1, c: 3, b: 2, d: NaN }); This test case fails while it seems pretty…
Joon
  • 9,346
  • 8
  • 48
  • 75
1
vote
1 answer

Should.js not finding object in array

I'm writing tests to validate what an async process has written to mongo and I'm having issues with should.include to verify that a record is included. To simplify it, my projection only includes a single field (ag_status) and I receive the…
frank
  • 501
  • 8
  • 21
1
vote
1 answer

Extending Object with a Non-Enumerable Property

I was reading the readme for should.js and got to the "OMG IT EXTENDS OBJECT???!?!@" section which says Yes, yes it does, with a single getter should, and no it won't break your code, because it does this properly with a non-enumerable…
Brad Dwyer
  • 6,305
  • 8
  • 48
  • 68
1
vote
1 answer

Comparing arrays from Mongoose using ShouldJS

Taking an array such as ['hello', 'there'] and storing that in a Mongoose document with a schema such as tags: { type: Array } using something such as: Something.create({ tags: ['hello', 'there']}, cb); Then using ShouldJS to check that the…
cyberwombat
  • 38,105
  • 35
  • 175
  • 251
1
vote
0 answers

Testing node application with Mocha and Should

I am javascript+node beginner and also relatively new to asynchronous programming style. I am comfortable with Ruby and Rails and now trying to teach myself node. I am working on a node app where I need to fetch data from Facebook for which I am…
Nitish Upreti
  • 6,312
  • 9
  • 50
  • 92
1
vote
3 answers

How would Object.defineProperty be in AS3?

I'm an architect from a strong JavaScript background, but I did some .NET and Java in the past. However, I wanted to put a hand on ActionScript3, which I was promised that is very related to JavaScript. As a startup project I took on myself to try…
1
vote
1 answer

Mocha runs correctly, but shows undefined

I use mocha to test my nodejs code, and the test runs just ok, but when I use mocha test.js to run test, it seems that the string I passed to describe does not show. The code is as follows: var assert = require("should"); describe("FrontEndTest",…
bxshi
  • 2,252
  • 5
  • 31
  • 50
0
votes
2 answers

How to check if array contains defined values using supertest?

Let's say in response during tests I have such array: array = [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' ] And I want to check if this array really contains those…
dokichan
  • 857
  • 2
  • 11
  • 44
0
votes
1 answer

should.have.property to verify key-value pair from object

I would like to check if key-value pair exist on a object. I use should.js with syntax: cy.gey(selector).should('have.property', 'Compasny Feature: ', ['open space ']); but I get this error Error: AssertionError: expected { Object (Company…
jacobcan118
  • 7,797
  • 12
  • 50
  • 95
0
votes
1 answer

How to set a range of Assertion in Cypress while trying to get the value from the CSS

This is my code: try { cy.get('.hello-bar-contentwrap') .should('have.css','padding-top','28px') .should('have.css','padding-right','37px') .should('have.css','padding-left','37px') } What I Intend to achieve is…
Akash
  • 61
  • 1
  • 6
0
votes
1 answer

Someone knows why mocha throw me error even if everything passed in tests?

I get this error even when everything still right in test Here the part of code And someone knows how to ignore this erros?
0
votes
1 answer

ShouldJS `should.equal` throws JavaScript heap out of memory

I've run into an issue where running mocha tests a simple check of should.equal(reactComponent, undefined) fail with FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory.
Ido Ran
  • 10,584
  • 17
  • 80
  • 143
0
votes
1 answer

Issue catching errors using should.js/Mocha

I am currently using Mocha and assertion library should.js I am trying to run through a situation in my unit tests where it will throw an exception - but from looking at the documentation I haven't had much luck in getting it to work thus far. The…
Studento919
  • 625
  • 2
  • 15
  • 44