UNPKG

savvy-js

Version:

Savvy - Style sheet documentation tool

46 lines (40 loc) 1.78 kB
(function(){ 'use strict'; var should = require('chai').should(), renderer = require('../js/renderer'), rimraf = require('rimraf'), fs = require('fs'), fileReader = require('../js/fileReader'), folderPath = 'c:/myVerySpecialTestFolderThatPropbablyDoesntExsist', targetFolderPath = 'c:/myVerySpecialTestFolderThatPropbablyDoesntExsist2', fileNames = ['a.js', 'b.css', 'c.html']; describe('renderer', function() { beforeEach(function(done){ // create a temp directory fs.mkdir(folderPath, function(){ fileNames.forEach(function(filePath){ fs.writeFileSync(folderPath + '/' + filePath, '123 test'); }); done(); }); }); afterEach(function(done){ // remove folder and files. rimraf(folderPath, function(){ rimraf(targetFolderPath, done); }); }); it('Render a file from assembled data', function(done){ var data = { a : '1' }; renderer.render(data, folderPath, targetFolderPath, [folderPath + '/b.css'], function(){ fs.existsSync(targetFolderPath).should.equal(true); fs.existsSync(targetFolderPath + '/a.js').should.equal(true); fs.existsSync(targetFolderPath + '/b.css').should.equal(true); fs.existsSync(targetFolderPath + '/c.html').should.equal(true); fs.existsSync(targetFolderPath + '/data.js').should.equal(true); fs.existsSync(targetFolderPath + '/data.js').should.equal(true); done(); }); }); }); }());