-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
42 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,48 @@ | ||
var EmailTemplates = require('../'); | ||
var assert = require('assert'); | ||
var path = require('path'); | ||
var cheerio = require('cheerio'); | ||
|
||
describe('EmailTemplates', function() { | ||
describe('constructor', function() { | ||
it('should return an object'); | ||
|
||
it('should accept no arguments'); | ||
|
||
it('should return an object', function() { | ||
var templates = new EmailTemplates(); | ||
assert.equal(Object.prototype.toString(templates), "[object Object]"); | ||
}); | ||
}); | ||
|
||
describe('render', function() { | ||
it("should feed errors through callback (nonexistent templates)"); | ||
it("should feed errors through callback (nonexistent templates)", function(done) { | ||
var templates = new EmailTemplates(); | ||
templates.render('nonexistent', null, function(err, html, text) { | ||
assert.equal(err.errno, -2); | ||
assert.equal(err.code, 'ENOENT'); | ||
done(); | ||
}); | ||
}); | ||
|
||
it("should respect the 'text' option", function(done) { | ||
var templates = new EmailTemplates({ | ||
root: "test/templates/", | ||
text: false | ||
}); | ||
|
||
templates.render('text_file_alternative.html', null, function(err, html, text) { | ||
assert.equal(text, null); | ||
done(err); | ||
}); | ||
}); | ||
}); | ||
|
||
it("should feed errors through callback (malformed context)"); | ||
describe('rewriteUrls', function() { | ||
|
||
it("should respect the 'text' attribute'"); | ||
it('should always pass strings to rewriteUrl function', function() { | ||
var $ = cheerio.load("<a>testing</a> <a href=''>testing-2</a>"); | ||
var templates = new EmailTemplates(); | ||
|
||
it("should look for templates in the specified location"); | ||
templates.rewriteUrls($, function(url) { | ||
assert.equal(typeof url, "string"); | ||
}); | ||
}); | ||
|
||
}); | ||
}) |