UNPKG

apeman-tmpl

Version:
67 lines (58 loc) 1.35 kB
/** * Test case for apemanTmpl. * Runs with mocha. */ 'use strict' const apemanTmpl = require('../lib/apeman_tmpl.js') const assert = require('assert') const mkdirp = require('mkdirp') describe('apeman-tmpl', () => { let mockApemanfile = require.resolve('../doc/mocks/mock-Apemanfile.js') let tmpDir = `${__dirname}/../tmp` before((done) => { mkdirp.sync(tmpDir) mkdirp.sync(require(mockApemanfile).$cwd) done() }) it('Apply tmpl.', (done) => { apemanTmpl({ configuration: mockApemanfile }).then( () => done(), (err) => assert.ifError(err) ) }) it('Apply tmpl with name.', (done) => { apemanTmpl('foo*/', { configuration: mockApemanfile }).then( () => done(), (err) => assert.ifError(err) ) }) it('List tmpls.', (done) => { apemanTmpl({ verbose: true, list: true, configuration: mockApemanfile }).then( () => done(), (err) => assert.ifError(err) ) }) it('Invalid cwd.', (done) => { let mockApemanfile = require.resolve('../doc/mocks/mock-invald-Apemanfile.js') apemanTmpl({ verbose: true, list: false, configuration: mockApemanfile }).then( () => done(), (err) => { assert.ok(!!err) done() } ) }) }) /* global describe, before, it */