Skip to content

Instantly share code, notes, and snippets.

@marr
Created August 7, 2015 00:55
Show Gist options
  • Save marr/aa3bb43eda25880e3773 to your computer and use it in GitHub Desktop.
Save marr/aa3bb43eda25880e3773 to your computer and use it in GitHub Desktop.
var expect = require('chai').expect;
describe('truthiness', function() {
function falsyFoo(x) {
return !(x && x.foo) || x;
}
it('doesn\'t blow up', function() {
expect(falsyFoo(undefined)).to.be.true;
expect(falsyFoo({ foo: false })).to.be.true;
expect(falsyFoo({ foo: true })).to.be.false;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment