Added the browser based test suite, have it running automatically via PhantomJS with grunt, all tests are passing except one, which requires PhantomJS send a body with a DELETE request

This commit is contained in:
Spencer Alger
2013-11-05 09:57:56 -07:00
parent 4273ffc2c7
commit 7e6fa479ad
34 changed files with 58054 additions and 1008 deletions

View File

@ -35,9 +35,6 @@ function transformFile(entry) {
var cmlKey = _.camelCase(key);
if (cmlKey !== key) {
param.name = key;
if (key.charAt(0) === '_') {
cmlKey = '_' + cmlKey;
}
}
note[cmlKey] = param;
}

View File

@ -33,7 +33,6 @@ var es = require('../../../src/elasticsearch'),
startingMoment = moment().startOf('day').subtract('days', days),
endingMoment = moment().endOf('day').add('days', days),
clientConfig = {
maxSockets: 1000,
log: {
level: 'error'
}

View File

@ -4,29 +4,35 @@
*/
var fs = require('fs');
var path = require('path');
var mkdirp = require('mkdirp');
var jsYaml = require('js-yaml');
var spec = require('../../get_spec');
var clean = require('../../clean');
var _ = require('../../../src/lib/utils');
var testDir = path.resolve(__dirname, '../../../test/integration/yaml_suite/tests');
var testFile = path.resolve(__dirname, '../../../test/integration/yaml_suite/yaml_tests.json');
function download() {
clean(testDir);
var tests = {};
clean(testFile);
spec.get('test/**/*.yaml')
.on('entry', function (entry) {
entry.path = path.resolve(testDir, path.relative('test', entry.path));
mkdirp.sync(path.dirname(entry.path));
fs.writeFileSync(entry.path, entry.data, 'utf8');
var filename = path.relative('test', entry.path);
var file = tests[filename] = [];
jsYaml.loadAll(entry.data, function (doc) {
file.push(doc);
});
})
.on('end', function () {
console.log('download yaml tests to', testDir);
fs.writeFileSync(testFile, JSON.stringify(tests, null, ' '), 'utf8');
console.log('download yaml tests to', testFile);
});
}
try {
var stat = fs.statSync(testDir);
if (!stat.isDirectory() || stat.ctime < Date.now() - 86400000) {
var stat = fs.statSync(testFile);
if (!stat.isFile() || stat.ctime < Date.now() - 86400000) {
download();
}
} catch (e) {