Menu

gitpiper

Mocha.js TDD interface Cheat Sheet in April 2024

Last Updated: 5 April 2024

README.md

TDD

mocha.setup('tdd');

suite('something', function() {
  setup(function() {
  });

  test('should work', function() {
  });

  teardown(function() {
  });
});

Async

test('should save', function(done) {
  var user = new User();
  user.save(function(err) {
    if (err) throw err;
    done();
  });
});

Chai: Expect

var expect = chai.expect;

expect(foo).to.be.a('string');
expect(foo).to.equal('bar');
expect(foo).to.have.length(3);
expect(tea).to.have.property('flavors').with.length(3);

See also


338+ more cheat sheets for you in April 2024

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️

© 2024 GitPiper. All rights reserved

Rackpiper Technology Inc

Company

About UsBlogContact

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️