0.0.4 • Published 6 years ago

track-spec v0.0.4

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

TrackSpec

A test framework of track.

Build Status

Installation

npm

npm install track-spec

Usage

This framework is extension of ospec.

Running test

package.json

"scripts": {
  "test": "ospec"
}
$ npm test

Example

TrackSpec has the methods of ospec and methods of like rspec. (describe, context, it, expect)

const t    = require('track-spec');
const Hoge = require('./hoge');

t.describe('Hoge', () => {
  t.describe('.hoge', () => {
    const subject = ( () => Hoge.hoge(type));
    let type = null;

    t.context('When type is `upper`', () => {
      t.beforeEach(() => {
        type = `upper`;
      });

      t.it('Return HOGE', () => {
        t.expect(subject()).equals('HOGE');
      });
    });

    t.context('When type is `lower`', () => {
      t.beforeEach(() => {
        type = `lower`;
      });

      t.it('Return hoge', () => {
        t.expect(subject()).equals('hoge');
      });
    });
  });
});

CONTRIBUTING

test

$ npm test

linter

$ npm run linter
0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago