mirror of
https://github.com/marko-js/marko.git
synced 2026-01-25 15:03:04 +00:00
Removed unused test files
This commit is contained in:
parent
3bf8ecb7d0
commit
4cccde482e
@ -1,56 +0,0 @@
|
||||
'use strict';
|
||||
var chai = require('chai');
|
||||
chai.Assertion.includeStack = true;
|
||||
require('chai').should();
|
||||
var expect = require('chai').expect;
|
||||
var nodePath = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
var dust = require('dustjs-linkedin');
|
||||
|
||||
dust.onLoad = function(path, callback) {
|
||||
if (!fs.existsSync(path)) {
|
||||
if (!path.endsWith('.dust')) {
|
||||
path += '.dust';
|
||||
}
|
||||
}
|
||||
|
||||
fs.readFile(path, 'utf-8', callback);
|
||||
};
|
||||
|
||||
require('../dust').registerHelpers(dust);
|
||||
|
||||
|
||||
xdescribe('marko-widgets/taglib' , function() {
|
||||
|
||||
beforeEach(function(done) {
|
||||
// for (var k in require.cache) {
|
||||
// if (require.cache.hasOwnProperty(k)) {
|
||||
// delete require.cache[k];
|
||||
// }
|
||||
// }
|
||||
|
||||
// require('raptor-logging').configureLoggers({
|
||||
// 'marko': 'INFO'
|
||||
// });
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('should render a page with a single widget', function(done) {
|
||||
require('./test-project/pages/dust').render(function(err, output) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
|
||||
try {
|
||||
console.log('output: ', output);
|
||||
done();
|
||||
} catch(e) {
|
||||
done(e);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@ -1,104 +0,0 @@
|
||||
'use strict';
|
||||
var chai = require('chai');
|
||||
chai.Assertion.includeStack = true;
|
||||
require('chai').should();
|
||||
var expect = require('chai').expect;
|
||||
var nodePath = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
var StringBuilder = require('raptor-strings/StringBuilder');
|
||||
|
||||
function testCompiler(path) {
|
||||
var inputPath = nodePath.join(__dirname, path);
|
||||
var expectedPath = nodePath.join(__dirname, path + '.expected.js');
|
||||
var actualPath = nodePath.join(__dirname, path + '.actual.js');
|
||||
|
||||
var compiler = require('marko/compiler').createCompiler(inputPath);
|
||||
var src = fs.readFileSync(inputPath, {encoding: 'utf8'});
|
||||
|
||||
var output = compiler.compile(src);
|
||||
fs.writeFileSync(actualPath, output, {encoding: 'utf8'});
|
||||
|
||||
var expected;
|
||||
try {
|
||||
expected = fs.readFileSync(expectedPath, {encoding: 'utf8'});
|
||||
}
|
||||
catch(e) {
|
||||
expected = 'TBD';
|
||||
fs.writeFileSync(expectedPath, expected, {encoding: 'utf8'});
|
||||
}
|
||||
|
||||
if (output !== expected) {
|
||||
throw new Error('Unexpected output for "' + inputPath + '":\nEXPECTED (' + expectedPath + '):\n---------\n' + expected +
|
||||
'\n---------\nACTUAL (' + actualPath + '):\n---------\n' + output + '\n---------');
|
||||
}
|
||||
}
|
||||
|
||||
function testRender(path, data, done, options) {
|
||||
var inputPath = nodePath.join(__dirname, path);
|
||||
var expectedPath = nodePath.join(__dirname, path + '.expected.html');
|
||||
var actualPath = nodePath.join(__dirname, path + '.actual.html');
|
||||
options = options || {};
|
||||
// var compiledPath = nodePath.join(__dirname, path + '.actual.js');
|
||||
// var compiler = require('marko/compiler').createCompiler(inputPath);
|
||||
// var src = fs.readFileSync(inputPath, {encoding: 'utf8'});
|
||||
|
||||
// var compiledSrc = compiler.compile(src);
|
||||
// fs.writeFileSync(compiledPath, compiledSrc, {encoding: 'utf8'});
|
||||
|
||||
var marko = require('marko');
|
||||
var Context = marko.Context;
|
||||
var context = options.context || new Context(new StringBuilder());
|
||||
|
||||
marko.render(inputPath, data, context)
|
||||
.on('finish', function() {
|
||||
var output = context.getOutput();
|
||||
|
||||
fs.writeFileSync(actualPath, output, {encoding: 'utf8'});
|
||||
|
||||
var expected;
|
||||
try {
|
||||
expected = options.expected || fs.readFileSync(expectedPath, {encoding: 'utf8'});
|
||||
}
|
||||
catch(e) {
|
||||
expected = 'TBD';
|
||||
fs.writeFileSync(expectedPath, expected, {encoding: 'utf8'});
|
||||
}
|
||||
|
||||
if (output !== expected) {
|
||||
throw new Error('Unexpected output for "' + inputPath + '":\nEXPECTED (' + expectedPath + '):\n---------\n' + expected +
|
||||
'\n---------\nACTUAL (' + actualPath + '):\n---------\n' + output + '\n---------');
|
||||
}
|
||||
|
||||
done();
|
||||
})
|
||||
.on('error', done)
|
||||
.end();
|
||||
}
|
||||
|
||||
xdescribe('marko-widgets/taglib' , function() {
|
||||
|
||||
beforeEach(function(done) {
|
||||
// for (var k in require.cache) {
|
||||
// if (require.cache.hasOwnProperty(k)) {
|
||||
// delete require.cache[k];
|
||||
// }
|
||||
// }
|
||||
|
||||
// require('raptor-logging').configureLoggers({
|
||||
// 'marko': 'INFO'
|
||||
// });
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('should compile a simple template with a w:widget attribute', function() {
|
||||
testCompiler('test-project/foo/view.marko');
|
||||
});
|
||||
|
||||
it('should render a simple page', function(done) {
|
||||
testRender('test-project/page1.marko', {}, done);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user