New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

sweet-assertions

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sweet-assertions

Syntax for writing informative testing assertions

latest
Source
npmnpm
Version
0.2.1
Version published
Weekly downloads
12
20%
Maintainers
1
Weekly downloads
 
Created
Source

sweet-assertions

Syntax for writing informative testing assertions.

This is a set of macros for Sweet.js which extends JavaScript grammar with syntax for writing informative testing assertions. It tries to generate assertion messages which contain useful information, like 1 should be == 2 would generate 1 should be equal to 2 error message and so on.

I suggest using it with sweet-bdd for better describe, it syntax:

% npm install --global sweet.js
% npm install sweet-bdd sweet-assertions

Use:

sjs -m sweet-bdd -m sweet-assertions tests.sjs

where tests.sjs looks like this:

var assert = require('assert');

describe "sweet-assertions" {

  function no() { throw new Error('x'); }
  function yes() { }

  it "works" {

    1 + 2 should == 2 + 1
    2 should != 1

    2 should > 1
    2 should >= 1
    1 should < 2
    1 should <= 2

    {x: 1} should have x

    true should be true
    false should be false

    true should be truthy
    null should be falsy

    no() should throw
    yes() should not throw

    "aabbcc" should contain "bb"
  }
}

Keywords

sweet-macros

FAQs

Package last updated on 01 Feb 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts