Skip to content

Commit f932400

Browse files
committed
Test coverage for new functionality
1 parent 1ae60e7 commit f932400

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = function (options) {
2+
return {
3+
name: 'Test template adapter',
4+
suppliedOptions: options
5+
};
6+
}

test/shared/app.test.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,41 @@ describe('BaseApp', function() {
2626
new MyApp();
2727
});
2828
});
29+
30+
describe('constructor', function() {
31+
context('with a custom templateAdapter module name', function() {
32+
beforeEach(function () {
33+
this.attributes = {templateAdapter: '../test/fixtures/app/template_adapter'};
34+
});
35+
36+
it('creates the templateAdapter we specify', function() {
37+
var app = new App(this.attributes);
38+
39+
expect(app.templateAdapter).to.have.property('name', 'Test template adapter');
40+
});
41+
42+
it('supplies the entryPath to the template adapter', function() {
43+
var app = new App(this.attributes, {entryPath: 'myEntryPath'});
44+
45+
expect(app.templateAdapter).to.have.deep.property('suppliedOptions.entryPath', 'myEntryPath');
46+
});
47+
});
48+
49+
context('with a concrete templateAdapterInstance', function() {
50+
it('uses the supplied templateAdapterInstance', function() {
51+
var myTemplateAdapter = {};
52+
var app = new App(null, {templateAdapterInstance: myTemplateAdapter});
53+
54+
expect(app.templateAdapter).to.equal(myTemplateAdapter);
55+
});
56+
57+
it('does not try to require a template adapter by name', function () {
58+
new App({
59+
templateAdapter: 'non existent module name - should throw'
60+
}, {
61+
templateAdapterInstance: {}
62+
});
63+
});
64+
});
65+
});
2966
});

0 commit comments

Comments
 (0)