Test if something is on the screen with reacting

I have an input field with a submit button and when someone enters something that text appears on the screen. how can I test that in react? I know how to simulate the button click but what would the expectation be? or how would I actually be able to

Chai - Testing values ​​in an array of objects

I am setting up my tests for the results to a REST endpoint that returns me an array of Mongo database objects. [{_id: 5, title: 'Blah', owner: 'Ted', description: 'something'...}, {_id: 70, title: 'GGG', owner: 'Ted', description: 'something'...}...

Mocha test fails at run time, but succeeds in debug mode

I've a mocha test which succeeds when I run it in debug mode, but fails in run mode (I'm using WebStorm). what I've done in the test is: it("test messenger", function(done){ messenger.send(message, callback); //the messenger will save messages t

Mocha / Otherwise mongoose test inside express

I try to test this express route with mocha, supertest and sinon. Test can't pass promise, it stop after the first mongoose call in User.find callback function with a pending error message : Error: timeout of 2000ms exceeded. Ensure the done() callba

Using Mocha Chai with Stormpath

My google-fu may have failed me, but I'm looking into building unit tests for an Express app that uses Stormpath for authentication. So a typical route looks something like this; app.get('/api/user', stormpath.loginRequired, userApi.get); How would I

Loop in a reminder returned chart using Mocha

i'm trying to achieve something like this : describe("TEST",function() { Offer.find({},{_id:1, title:1}).exec(function(error, offers) { for (var i = 0; i < offers.length; i++) { it("Ask transaction : " + offers[i].title, function(do

Api goes postman but fails mocha js

i have some API and if i test them with postman its working fine. but if i try to test that API with same data in mocha js, some API are working and some are giving me an error like "500 internal server error" and "400 bad request". i

How can I use the setTimeout () functions in Mocha test cases?

I'm writing a test in Mocha / Node js and want to use a setTimeout to wait for a period before executing a block of code. How can I accomplish this? It appears that within a Mocha test case, setTimeout() does not work. (I am aware that you can setTim

Test the non-exported TypeScript function

I use Mocha/Chai for testing JavaScript front-end code and now we switched to TypeScript. I have several functions I want to test. But they shouldn't be exportable. Can I get an access to this functions and test it without adding export to them?There

Moka Breakpoints Using Visual Studio Code

Is it possible to add breakpoints to ones Mocha tests using Visual Studio Code? Normally when debugging code one need to configure the launch.json, setting the program attribute to the javascript file to execute. I am not sure how to do this for for

Reading a variable value in a function named in javascript

This may be very simple but i lost my way in finding the answer, I have a named function inside a Backbone view. I'm trying to write unit test for this named function and i could see a variable is being declared in function scope. The state of this v

Access to JavaScript global variables for unit tests

Hello I am new JavaScript unit testing and I'm using Mocha.js and Chai.js What I want to do is simply figure out how to check the value of a global variable in a seperate js file. Here is my code Here is the main.js file (code to be tested) Just has

How to test the non-nullity of a property in Chai-as-Promised

How do I test that an object retrieved from a fulfilled promise has a non-null property? I have a promise that returns an object similar to the following: { id: 1, aDate: 2015-02-12T11:50:00.511Z } I need to check that the aDate property is set and n

Retry mocha test failed

I have some requirement that demands to retry mocha failure tests multiple times. Is there any easy way/workaround to do this? I tried https://github.com/giggio/mocha-retry, but it doesn't seem to work for me with Mocha 1.21.3: it (2, 'sample test',

JS Sails: Unit Test of the Common Server Boot File

I'm using Mocha (along with supertest, should, etc...) I'm testing the following controllers and models (example): Controller1, Controller2, Model1, Model2. I save my tests under ./tests/controller/controller1.js ./tests/controller/controller2.js ./t

How to test the REST API + MVC applications on the client side?

When you have a RESTful server which only responds with JSON by fetching some information from the database, and then you have a client-side application, such as Backbone, Ember or Angular, from which side do you test an application? Do I need two te

Run mocha of phantomjs

I'd like to do some BDD using Mocha and PhantomJS only. Define a few functional paths and test 'em. In short, I'd love to run the command phantomjs test.js while test.js contains something like this: var mocha = require("mocha"); // This one fai

Moka prematurely leaves the tests

I am using Mocha to run some tests on my SnailMailAddressParser project from the command-line. Unfortunately only some tests are run before Mocha exits. The test file is very straightforward. You can see the test file here: test/test.coffee It seems

how to test the client http node.js with mocha?

I have a node.js module that HTTP POSTs a JSON request, I want to test for correct url, headers, request body and that the request is actually executed. I'm using Mocha for a testing framework. how do I test it ?You can use nock. you can intercept th

Clean stubs easily

Is there a way to easily reset all sinon spys mocks and stubs that will work cleanly with mocha's beforeEach blocks. I see sandboxing is an option but I do not see how you can use a sandbox for this beforeEach -> sinon.stub some, 'method' sinon.stub

Can not run Mocha with CoffeeScript

Makefile - Content: REPORTER = dot all: build build: @./node_modules/coffee-script/bin/coffee \ -c \ -o lib src clean: rm -rf lib mkdir lib watch: @./node_modules/coffee-script/bin/coffee \ -o lib \ -cw src test: @./node_modules/mocha/bin/mocha \ --r

Make fun of rspec and mocha together

For a test suite that's already using mocha for mocking, can new tests be written with rspec mocking? maybe turn that on before(:all) and turn it back to mocha after(:all) I tried changing the Spec::Runner configuration at run-time and that didn't se