Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe("Scripts", () => {
leche.withData(scriptOnlyTestFiles, filename => {
const version = filename.slice(0, filename.indexOf("/"));
// Uncomment and fill in filename to focus on a single file
// var filename = "newTarget/simple-new-target";
const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`);
it("should parse correctly when sourceType is script", () => {
config.ecmaVersion = Number(version);
const expected = require(`${path.resolve(__dirname, "../../", FIXTURES_DIR, filename)}.result.js`);
tester.assertMatches(code, config, expected);
});
});
describe("ecmaFeatures", () => {
let config;
beforeEach(() => {
config = {
loc: true,
range: true,
tokens: true,
ecmaVersion: 6,
ecmaFeatures: {}
};
});
leche.withData(testFiles, filename => {
// Uncomment and fill in filename to focus on a single file
// var filename = "jsx/invalid-matching-placeholder-in-closing-tag";
const feature = path.dirname(filename),
isPermissive = !shouldThrowInTestsWhenEnabled(feature),
code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`);
it(`should parse correctly when ${feature} is ${isPermissive}`, () => {
config.ecmaFeatures[feature] = isPermissive;
const expected = require(`${path.resolve(__dirname, "../../", FIXTURES_DIR, filename)}.result.js`);
tester.assertMatches(code, config, expected);
});
it(`should throw an error when ${feature} is ${!isPermissive}`, () => {
config.ecmaFeatures[feature] = !isPermissive;
describe("Libraries", () => {
leche.withData(testFiles, filename => {
// var filename = "angular-1.2.5.js";
it("should produce correct AST when parsed", function() {
this.timeout(10000); // eslint-disable-line no-invalid-this
const output = shelljs.cat(path.resolve(__dirname, "../../", `${filename}.result.json`));
const input = shelljs.cat(filename);
const result = JSON.stringify(tester.getRaw(espree.parse(input, {
loc: true,
range: true,
tokens: true
})));
describe("Each pending namespace descriptor should be valid.", function() {
var testVectors = {};
resolveResults.pendingResolutionStack.forEach( function(options_) {
testVectors[options_.targetNamespaceDescriptor.jsonTag] = [ options_ ];
});
withData(testVectors, function(options_) {
var optionsValid = false;
it("Attempt to validate the pending namespace descriptor should not throw.", function() {
var functionUnderTest = function() {
optionsValid = namedObjectContext.checkValidContextInput(options_);
};
assert.doesNotThrow(functionUnderTest);
});
it("The pending namespace descriptor resolve options object should be valid.", function() {
assert.isTrue(optionsValid);
});
});
it("Execute the test suite.", function() {
assert.isTrue(true);
});
});
});
describe("attachComment: true", () => {
leche.withData(testFiles, filename => {
it("should produce correct AST when parsed with attachComments", () => {
const output = require(path.resolve(__dirname, "../../", `${filename}.result.js`));
const input = shelljs.cat(`${filename}.src.js`);
let result;
if (output.sourceType === "script") {
result = espree.parse(input, {
loc: true,
range: true,
tokens: true,
attachComment: true
});
} else {
result = espree.parse(input, {
loc: true,
range: true,
module.exports = describe("onm.Model intrinsic semantic bindings white box tests", function() {
withData(testInputDataVector, function (testDescriptor_) {
var model = null;
var address = null;
var store = null;
var namespace = null;
before(function(done_) {
if (testDescriptor_.validConfig) {
assert.doesNotThrow(function() {
model = new onm.Model(testDescriptor_.dataModelDeclaration);
assert.isNotNull(model);
assert.instanceOf(model, onm.Model);
});
assert.doesNotThrow(function() {
store = new onm.Store(model);
assert.isNotNull(store);
assert.instanceOf(store, onm.Store);
describe('JSON export and import', () => {
withData(
{
'one line': 'line-merge.pdf',
'big text': 'text-order-detection.pdf',
},
pdfName => {
let pdfBefore: Document;
let pdfAfter: Document;
function clean(pdf: Document): Promise {
Element.resetGlobalId();
return runModules(pdf, [
new ReadingOrderDetectionModule(),
new WordsToLineModule(),
new LinesToParagraphModule(),
new HierarchyDetectionModule(),
]);