moisty

1.0.4 • Public • Published

An npm package to test your application using pure vanilla JavaScript.

https://www.npmjs.com/package/moisty

Example Usage of Basic Matchers

Example model:

function Notepad(name) {
  this.content = []
  this.name = name
  this.colors = []
}

Example test file:

(function notepadIsEmpty() {
  var notepad = new Notepad();
  expect.toBeEmpty(notepad.content);
})();

(function notepadNameIsDefined() {
  var notepad = new Notepad('My notepad');
  expect.toBeTrue(notepad.name != undefined);
})();

(function notepadNameCanBeSet() {
  var notepad = new Notepad('Moisty Notepad');
  expect.toEqual(notepad.name, 'Moisty Notepad');
})();

(function notepadCanIncludeColors() {
  var notepad = new Notepad();
  notepad.colors.push('blue');
  expect.toInclude(notepad.colors, 'blue');
})();

Example Usage of beforeEach and It blocks

describe('Notepad', function() {
  var notepad;

  beforeEach(function() {
    // We create a new instance of Notepad before running every it block
    notepad = new Notepad();
  });

  it('----> it is empty*', function() {
    expect.toBeEmpty(notepad.content);
  });

  it('----> it includes Hello Moon', function() {
    notepad.content.push('Hello Moon!');
    expect.toInclude(notepad.content, 'Hello Moon!'); => True
  });

  it('----> it includes Hello Moon', function() {
    notepad.content.push('Hello World');
    expect.toInclude(notepad.content, 'Hello Moon'); => False
  });
});

HTML Runner

HTML Moist Runner

NOW WITH GIFS!

When tests fail:

Not Moist

When tests pass:

Moist

Readme

Keywords

none

Package Sidebar

Install

npm i moisty

Weekly Downloads

0

Version

1.0.4

License

ISC

Unpacked Size

1.94 MB

Total Files

13

Last publish

Collaborators

  • dkeen0123
  • jestfer
  • joshuajfholloway
  • kotauror
  • lwkchan
  • telgi