Skip to content

xRoulanDx/jasmine-paratest

Repository files navigation

Jasmine Paratest

Build Status Coverage Status

Parameterize your it assertions, reduce lines of code and improve readability of your tests with this library.

Installation

Requires jasmine v2+ to run.

$ npm install -D jasmine-paratest

Usage

Configure cases for single it assertion.

import {Para} from 'jasmine-paratest';

describe('Tests for isEven method', () => {
    Para.case(32)
        .fcase(12) // same as fit
        .xcase(33) // same as xit
        .case(2) // same as it
        .case(64)
        .it('Method should return true for $1', number => {
            // arrange
            // Configure mocks and stubs by case's data

            // act
            const result = isEven(number);

            // assert
            expect(result).toBeTruthy();
        });
});

Test run will looks like

Tests for isEven method
    Method should return true for 32
    Method should return true for 12
    Method should return true for 33
    Method should return true for 2
    Method should return true for 64