Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
blutorange committed Jan 14, 2023
1 parent bfb18b2 commit 74d689d
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions test/ejs.js
Expand Up @@ -272,8 +272,8 @@ suite('client mode', function () {

test('supports error handler in client mode', function () {
assert.equal(ejs.render('<%= it.does.not.exist %>', {}, {
client: true, error: function(e,escapeFn){return (e instanceof ReferenceError) + escapeFn('&')}
}), "true&amp;");
client: true, error: function(e,escapeFn){return (e instanceof ReferenceError) + escapeFn('&');}
}), 'true&amp;');
});
});

Expand Down Expand Up @@ -925,17 +925,17 @@ suite('exceptions', function () {
});

test('catches errors in expressions in escaped mode', function () {
assert.equal(ejs.render('<%= it.does.not.exist %>', {}, {error: function(){return 'error'}}),
"error");
assert.equal(ejs.render('<%= it.does.not.exist %>', {}, {error: function(){return 'error';}}),
'error');
});

testAsync('catches errors in expressions in escaped mode with async', function (done) {
ejs.render('<%= await it.does.not.exist %><%=await Promise.resolve(42)%><%=await Promise.reject(0)%>', {}, {
async: true,
error: function(){return 'error'}
async: true,
error: function(){return 'error';}
}).then(function(value) {
try {
assert.equal(value, "error42error");
assert.equal(value, 'error42error');
}
finally {
done();
Expand All @@ -944,27 +944,27 @@ suite('exceptions', function () {
});

test('passes the escapeFn to the error handler in escaped mode', function () {
assert.equal(ejs.render('<%= it.does.not.exist %>', {}, {error: function(_, escapeFn){return escapeFn("&")}}),
"&amp;");
assert.equal(ejs.render('<%= it.does.not.exist %>', {}, {error: function(_, escapeFn){return escapeFn('&');}}),
'&amp;');
});

test('passes the error object to the error handler in escaped mode', function () {
assert.equal(ejs.render('<%= it.does.not.exist %>', {}, {error: function(e){return e instanceof ReferenceError}}),
"true");
assert.equal(ejs.render('<%= it.does.not.exist %>', {}, {error: function(e){return e instanceof ReferenceError;}}),
'true');
});

test('catches errors in expressions in raw mode', function () {
assert.equal(ejs.render('<%- it.does.not.exist %>', {}, {error: function(){return 'error'}}),
"error");
assert.equal(ejs.render('<%- it.does.not.exist %>', {}, {error: function(){return 'error';}}),
'error');
});

testAsync('catches errors in expressions in raw mode with async', function (done) {
ejs.render('<%- await it.does.not.exist %><%-await Promise.resolve(42)%><%-await Promise.reject(0)%>', {}, {
async: true,
error: function(){return 'error'}
async: true,
error: function(){return 'error';}
}).then(function(value) {
try {
assert.equal(value, "error42error");
assert.equal(value, 'error42error');
}
finally {
done();
Expand All @@ -973,13 +973,13 @@ suite('exceptions', function () {
});

test('passes the escapeFn to the error handler in raw mode', function () {
assert.equal(ejs.render('<%- it.does.not.exist %>', {}, {error: function(_, escapeFn){return escapeFn("&")}}),
"&amp;");
assert.equal(ejs.render('<%- it.does.not.exist %>', {}, {error: function(_, escapeFn){return escapeFn('&');}}),
'&amp;');
});

test('passes the error object to the error handler in raw mode', function () {
assert.equal(ejs.render('<%- it.does.not.exist %>', {}, {error: function(e){return e instanceof ReferenceError}}),
"true");
assert.equal(ejs.render('<%- it.does.not.exist %>', {}, {error: function(e){return e instanceof ReferenceError;}}),
'true');
});

teardown(function() {
Expand Down

0 comments on commit 74d689d

Please sign in to comment.