Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Clone in Desktop Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

36 lines (28 sloc) 1.31 KB
var Checker = require('../../../lib/checker');
var expect = require('chai').expect;
describe('rules/require-padding-newlines-before-export', function() {
var checker;
beforeEach(function() {
checker = new Checker();
checker.registerDefaultRules();
});
describe('value true', function() {
beforeEach(function() {
checker.configure({ requirePaddingNewLinesBeforeExport: true });
});
it('should report missing padding before export', function() {
expect(checker.checkString('var a = 2;\nmodule.exports = a;'))
.to.have.one.validation.error.from('requirePaddingNewLinesBeforeExport');
});
it('should not report missing padding if first line', function() {
expect(checker.checkString('module.exports = 2;')).to.have.no.errors();
});
it('should not report padding before export', function() {
expect(checker.checkString('var a = 2;\n\nmodule.exports = a;')).to.have.no.errors();
});
it('should not report lack of padding before object assignment', function() {
expect(checker.checkString('var a = 2;\nfoo.exports = a;')).to.have.no.errors();
expect(checker.checkString('var a = 2;\nmodule.foo = a;')).to.have.no.errors();
});
});
});
Jump to Line
Something went wrong with that request. Please try again.