If we have a unit test file my-spec.js and running with mocha:   mocha my-spec.js   The default timeout will be 2000 ms. It can be overwritten for partial test with a command line parameter:   mocha my-spec.js --timeout 5000   Is it possible to cha...
I'm having some trouble unit testing the router in my application, which is built on the Angular ui router. What I want to test is whether state transitions change the URL appropriately (there will be more complicated tests later, but this is w...
I have the following ES6 modules:  network.js  export function getDataFromServer() {   return ... }   widget.js  import { getDataFromServer } from 'network.js';  export class Widget() {   constructor() {     getDataFromServer("dataForWi...
I'm trying to fiddle with Ecmascript 6 modules using webpack + traceur to transpile to ES5 CommonJS, but I'm having trouble successfully unit testing them.  I tried using Jest + traceur preprocessor, but the automocking and dependency names s...
What are some good resources to learn best practices for Javascript?  I'm mainly concerned about when something should be an object vs. when it should just be tracked in the DOM.  Also I would like to better learn how to organize my code so it&#...
This is a somewhat of a follow-on question to this one: Mocking $modal in AngularJS unit tests  The referenced SO is an excellent question with very useful answer. The question I am left with after this however is this: how do I unit test the modal i...
I am writing some QUnit tests for a JavaScript that makes AJAX calls.  For isolation I overwrite $.ajax to write the parameter array of an AJAX call to a variable. This works to test how methods use AJAX functions, but I have difficulty testing the s...
I want to test my angular app with protractor. The app has an API Module that talks to the server During these tests I want to mock this Api Module. I don't want to do full integration tests, but tests from the user input with expected values fro...
I'm testing service A, but service A depends on service B (i.e. service B is injected into service A).  I've seen this question but my case is a bit different because in my opinion it makes more sense to mock service B instead of injecting an...
I'm working with some code where I need to test type of exception thrown by function (Is it TypeError, ReferenceError etc.).  My current testing framework is AVA and I can test it as a second argument t.throws method, like here:  it('should t...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.