tadajs

0.1.80 • Public • Published

TADA! - Test Angular Driven Application

Handy utils for Angular unit testing

  1. What
  2. Why
  3. Installation
  4. Usage
  5. API
  6. Demo

What

TADA is a set of smart spies that will make your unit tests more readable.

It was born after writing the same patterns again and again and after writing hundreds of bad looking / unreadble tests.

For more info checkout our slides or watch the video of the talk we gave at AngularJS IL.

Why

  1. Your tests will look better and will be more readable.
  2. No more writing the same mocks over and over again.
  3. No more writing complicated async mocks using $q and adding ugly $disget() calls in the middle of your tests.
  4. Use our enhanced spies with the apis such as:
spy.whenCalledWithArgs(myArgs).returns(customResponse);

Installation

Download latest release from here or use bower (recommended)

bower install tada --save-dev

Usage

  • Load tada.js in your favourite test runner (i.e karma):
    // list of files / patterns to load in the browser
    files: [
      'app/bower_components/tada/dist/concat/scripts/tada.js',
    ]
  • Create your app test kit file (recommended place is under specs/lib)
'use strict';

angular.module('myAppTestKit', ['tada'])
  .service('myServiceMock', function (tadaUtils) {
    this.asyncServiceMethod = tadaUtils.createAsyncFunc('async service method');
    this.syncedMethod = tadaUtils.createFunc('service synced method');
  })
  .service('thirdPartyServiceMock', function (tadaUtils) {
    this.doSomething = tadaUtils.createFunc('do something');
  });
  • Load the test kit module in your test and pick which dependencies you whould like to mock.
    module('myAppTestKit', function (tadaUtilsProvider) {
      tadaUtilsProvider.mock('thirdPartyService');
    });

API

Cooming soon

Demo

You can checkout TADA showcase here

Readme

Keywords

none

Package Sidebar

Install

npm i tadajs

Weekly Downloads

86

Version

0.1.80

License

none

Unpacked Size

3.37 MB

Total Files

242

Last publish

Collaborators

  • arielh
  • falconci
  • yurynix
  • itai.benda
  • wix-ci
  • wix-ambassador
  • shahata
  • netanelgilad
  • wix-ci-publisher
  • wix-bi-publisher