Files
elasticsearch-js/test/integration/yaml_suite/yaml_file.js
Spencer 7c1573fb07 Use standard and prettier (#10)
* switch from custom eslint config to standard + prettier

* fix new standard eslint violations

* add editorconfig file

* auto-fix all other violations

* update lint yarn script

* remove jshint comment
2019-07-09 13:24:13 -07:00

50 lines
1.1 KiB
JavaScript

/* eslint-env mocha */
/* eslint-disable no-console */
/**
* Class representing a YAML file
* @type {[type]}
*/
module.exports = YamlFile;
var YamlDoc = require('./yaml_doc');
var clientManager = require('./client_manager');
var _ = require('lodash');
var async = require('async');
function YamlFile(filename, docs) {
var file = this;
// file level skipping flag
file.skipping = false;
describe(filename, function() {
file.docs = _.map(docs, function(doc) {
doc = new YamlDoc(doc, file);
if (doc.description === 'setup') {
beforeEach(
/* doc */ function(done) {
async.series(doc.getActionsRunners(), done);
}
);
} else {
it(doc.description, function(done) {
async.series(doc.getActionsRunners(), done);
});
}
});
afterEach(
/* doc */ function() {
clientManager
.get()
.transport.log.debug(
'===========================\n' +
'Cleanup\n' +
'==========================='
);
return clientManager.get().clearEs();
}
);
});
}