UNPKG

base-test-suite

Version:
37 lines (29 loc) 996 B
'use strict'; var path = require('path'); var assert = require('assert'); var fixtures = path.resolve.bind(path, __dirname, 'fixtures'); module.exports = function(App, options, runner) { var app; describe('collection.getView', function() { beforeEach(function() { app = new App(); app.create('page'); app.page('foo', {content: 'this is foo'}); app.page('bar.md', {content: 'this is bar'}); app.page('a/b/c/baz.md', {content: 'this is baz'}); app.page(fixtures('templates/a.tmpl')); }); it('should get a view by name', function() { assert(app.pages.getView('foo')); }); it('should get a view with the key modified by the given function', function() { var view = app.pages.getView('foo.md', function(key) { return path.basename(key, path.extname(key)); }); assert(view); }); it('should get a view by full path', function() { assert(app.pages.getView('a/b/c/baz.md')); }); }); };