diff --git a/lib/tags/extends.test.js b/lib/tags/extends.test.js index 8166912a..dbc985a6 100644 --- a/lib/tags/extends.test.js +++ b/lib/tags/extends.test.js @@ -1,5 +1,4 @@ -var testCase = require('nodeunit').testCase, - swig = require('../../index'); +var swig = require('../../index'); describe('Tag: extends', function () { diff --git a/lib/tags/filter.test.js b/lib/tags/filter.test.js index 234b46d9..dfef0ddd 100644 --- a/lib/tags/filter.test.js +++ b/lib/tags/filter.test.js @@ -1,27 +1,21 @@ -var testCase = require('nodeunit').testCase, - swig = require('../../index'); +var swig = require('../../index'); -exports.filter = testCase({ - setUp: function (callback) { +describe('Tag: filter', function () { + beforeEach(function () { swig.init({}); - callback(); - }, + }); - basic: function (test) { - var tpl = swig.compile('{% filter capitalize %}oh HEY there{% endfilter %}'); - test.strictEqual(tpl({}), 'Oh hey there'); - test.done(); - }, + it('accepts a filter as an argument', function () { + swig.compile('{% filter capitalize %}oh HEY there{% endfilter %}')({}).should.equal('Oh hey there'); + }); - 'complex content': function (test) { + it('works across complex content', function () { var tpl = swig.compile('{% filter capitalize %}oh {{ foo }} {% if here %}here{% else %}there{% endif %}{% endfilter %}'); - test.strictEqual(tpl({ foo: 'HEY', here: true }), 'Oh hey here'); - test.done(); - }, + tpl({ foo: 'HEY', here: true }).should.equal('Oh hey here'); + }); - args: function (test) { + it('can accept arguments for the filter', function () { var tpl = swig.compile('{% filter replace "\\." "!" "g" %}hi. my name is paul.{% endfilter %}'); - test.strictEqual(tpl({}), 'hi! my name is paul!'); - test.done(); - } + tpl({}).should.equal('hi! my name is paul!'); + }); });