<commit_before>import slimdom from 'slimdom';

import blueprint from 'fontoxml-blueprints/readOnlyBlueprint';
import createSelectorFromXPathAsync from 'fontoxml-selectors/parsing/createSelectorFromXPathAsync';
import evaluateXPath from 'fontoxml-selectors/evaluateXPath';

describe('createSelectorFromXPathAsync', () => {
	let documentNode;
	beforeEach(() => {
		documentNode = slimdom.createDocument();
	});

	it('can compile a selector asynchronously', () => {
		return createSelectorFromXPathAsync('1 + 1')
			.then(
				function (selector) {
					// Assume selector to be ok
					chai.expect(
						evaluateXPath(selector, documentNode, blueprint, {}, evaluateXPath.NUMBER_TYPE)
					).to.equal(2);
				},
				() => {
					chai.expect.fail();
				});
	}).timeout(5000);

	it('throws when compilation fails', () => {
		return createSelectorFromXPathAsync(']] Not valid at all! [[')
			.then(function (selector) {
				chai.expect.fail();
			}, function (error) {
				chai.expect(error).to.be.instanceOf(Error);
			});
	});
});<commit_msg>Increase timeouts for async query compilation even more.<commit_after>import slimdom from 'slimdom';

import blueprint from 'fontoxml-blueprints/readOnlyBlueprint';
import createSelectorFromXPathAsync from 'fontoxml-selectors/parsing/createSelectorFromXPathAsync';
import evaluateXPath from 'fontoxml-selectors/evaluateXPath';

describe('createSelectorFromXPathAsync', () => {
	let documentNode;
	beforeEach(() => {
		documentNode = slimdom.createDocument();
	});

	it('can compile a selector asynchronously', () => {
		return createSelectorFromXPathAsync('1 + 1')
			.then(
				function (selector) {
					// Assume selector to be ok
					chai.expect(
						evaluateXPath(selector, documentNode, blueprint, {}, evaluateXPath.NUMBER_TYPE)
					).to.equal(2);
				},
				() => {
					chai.expect.fail();
				});
	}).timeout(10000);

	it('throws when compilation fails', () => {
		return createSelectorFromXPathAsync(']] Not valid at all! [[')
			.then(function (selector) {
				chai.expect.fail();
			}, function (error) {
				chai.expect(error).to.be.instanceOf(Error);
			});
	}).timeout(10000);
});
{'fraction_non_alphanumeric': 0.1477325853202431, 'fraction_numerical': 0.009350163627863487, 'mean_word_length': 4.376884422110553, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2765436', 'n_tokens_mistral': 780, 'n_tokens_neox': 651, 'n_words': 132}