add test timer. Remove operations related to esprima
This commit is contained in:
parent
8f85e57fc5
commit
fbcb626fd0
@ -19,6 +19,10 @@ export default [
|
||||
"Unzip",
|
||||
"Zip",
|
||||
|
||||
// esprima doesn't work in .mjs
|
||||
"JavaScriptBeautify",
|
||||
"JavaScriptMinify",
|
||||
"JavaScriptParse",
|
||||
|
||||
// Relies on state of recipe.
|
||||
// "Magic",
|
||||
|
@ -121,8 +121,6 @@ import {
|
||||
JPathExpression as core_JPathExpression,
|
||||
JSONBeautify as core_JSONBeautify,
|
||||
JSONMinify as core_JSONMinify,
|
||||
JavaScriptBeautify as core_JavaScriptBeautify,
|
||||
JavaScriptMinify as core_JavaScriptMinify,
|
||||
JavaScriptParser as core_JavaScriptParser,
|
||||
Keccak as core_Keccak,
|
||||
MD2 as core_MD2,
|
||||
@ -382,8 +380,6 @@ function generateChef() {
|
||||
"JPathExpression": wrap(core_JPathExpression),
|
||||
"JSONBeautify": wrap(core_JSONBeautify),
|
||||
"JSONMinify": wrap(core_JSONMinify),
|
||||
"javaScriptBeautify": wrap(core_JavaScriptBeautify),
|
||||
"javaScriptMinify": wrap(core_JavaScriptMinify),
|
||||
"javaScriptParser": wrap(core_JavaScriptParser),
|
||||
"keccak": wrap(core_Keccak),
|
||||
"MD2": wrap(core_MD2),
|
||||
@ -627,8 +623,6 @@ const hexToPEM = chef.hexToPEM;
|
||||
const JPathExpression = chef.JPathExpression;
|
||||
const JSONBeautify = chef.JSONBeautify;
|
||||
const JSONMinify = chef.JSONMinify;
|
||||
const javaScriptBeautify = chef.javaScriptBeautify;
|
||||
const javaScriptMinify = chef.javaScriptMinify;
|
||||
const javaScriptParser = chef.javaScriptParser;
|
||||
const keccak = chef.keccak;
|
||||
const MD2 = chef.MD2;
|
||||
@ -870,8 +864,6 @@ const operations = [
|
||||
JPathExpression,
|
||||
JSONBeautify,
|
||||
JSONMinify,
|
||||
javaScriptBeautify,
|
||||
javaScriptMinify,
|
||||
javaScriptParser,
|
||||
keccak,
|
||||
MD2,
|
||||
@ -1116,8 +1108,6 @@ export {
|
||||
JPathExpression,
|
||||
JSONBeautify,
|
||||
JSONMinify,
|
||||
javaScriptBeautify,
|
||||
javaScriptMinify,
|
||||
javaScriptParser,
|
||||
keccak,
|
||||
MD2,
|
||||
|
@ -124,11 +124,14 @@ setTimeout(function() {
|
||||
process.exit(1);
|
||||
}, 10 * 1000);
|
||||
|
||||
const start = new Date();
|
||||
|
||||
Promise.all([
|
||||
TestRegister.runTests(),
|
||||
TestRegister.runApiTests()
|
||||
])
|
||||
.then(function(resultsPair) {
|
||||
const finish = new Date();
|
||||
const results = resultsPair[0].concat(resultsPair[1]);
|
||||
results.forEach(handleTestResult);
|
||||
|
||||
@ -145,6 +148,8 @@ Promise.all([
|
||||
console.log("\nNot all tests are passing");
|
||||
}
|
||||
|
||||
console.log(`Tests took ${(finish - start) / 1000} seconds`);
|
||||
|
||||
process.exit(allTestsPassing ? 0 : 1);
|
||||
});
|
||||
|
||||
|
@ -108,9 +108,12 @@ Tiger-128`;
|
||||
|
||||
it("AND", () => {
|
||||
const result = chef.AND("Scot-free", {
|
||||
key: "Raining Cats and Dogs",
|
||||
key: {
|
||||
string: "Raining Cats and Dogs",
|
||||
option: "Hex",
|
||||
}
|
||||
});
|
||||
assert.strictEqual(result.toString(), ".\"M$(D E.");
|
||||
assert.strictEqual(result.toString(), "\u0000\"M$(D E");
|
||||
}),
|
||||
|
||||
it("atBash Cipher", () => {
|
||||
@ -194,16 +197,11 @@ Full hash: $2a$10$ODeP1.6fMsb.ENk2ngPUCO7qTGVPyHA9TqDVcyupyed8FjsiF65L6`;
|
||||
assert.strictEqual(result.toString(), "Fool's Gold");
|
||||
}),
|
||||
|
||||
it("BSON Deserialise", () => {
|
||||
const result = chef.BSONDeserialise("....phrase.....Mouth-watering..");
|
||||
it("BSON Serialise / Deserialise", () => {
|
||||
const result = chef.BSONDeserialise(chef.BSONSerialise({"phrase": "Mouth-watering"}));
|
||||
assert.strictEqual(result.toString(), "{\"phrase\": \"Mouth-watering\"}");
|
||||
}),
|
||||
|
||||
it("BSON Serialise", () => {
|
||||
const result = chef.BSONSerialise({"phrase": "Mouth-watering"});
|
||||
assert.strictEqual(result.toString(), " ....phrase.....Mouth-watering..");
|
||||
}),
|
||||
|
||||
it("Bzip2 Decompress", () => {
|
||||
const result = chef.bzip2Decompress(chef.fromBase64("QlpoOTFBWSZTWUdQlt0AAAIVgEAAAQAmJAwAIAAxBkxA0A2pTL6U2CozxdyRThQkEdQlt0A="));
|
||||
assert.strictEqual(result.toString(), "Fit as a Fiddle");
|
||||
@ -642,53 +640,6 @@ WWFkYSBZYWRh\r
|
||||
assert.strictEqual(chef.HMAC("On Cloud Nine", {key: "idea"}).toString(), "b128b48ec0d6b0f1a27220c396d0f3e5");
|
||||
}),
|
||||
|
||||
it("Javascript beautify", () => {
|
||||
const result = chef.javaScriptBeautify("const b = 2, g = 7;const fun = (a) => {return a*a};");
|
||||
const expected = `const b = 2, g = 7;
|
||||
const fun = a => {
|
||||
return a * a;'
|
||||
};`;
|
||||
assert.strictEqual(result.toString(), expected);
|
||||
}),
|
||||
|
||||
it("JavaScript Minify", () => {
|
||||
const result = chef.javaScriptMinify(`const b = 2, g = 7;
|
||||
const fun = a => {
|
||||
return a * a;
|
||||
};`);
|
||||
const expected = "const b = 2, g = 7;const fun = (a) => {return a*a};";
|
||||
assert.strictEqual(result.toString(), expected);
|
||||
}),
|
||||
|
||||
it("JavaScript Parse", () => {
|
||||
const result = chef.javaScriptParser("const b = 2;");
|
||||
const expected = `{
|
||||
"type": "Program",
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"name": "b"
|
||||
},
|
||||
"init": {
|
||||
"type": "Literal",
|
||||
"value": 2,
|
||||
"raw": "2"
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
}
|
||||
],
|
||||
"sourceType": "script"
|
||||
}`;
|
||||
assert.strictEqual(result.toString(), expected);
|
||||
}),
|
||||
|
||||
it("JPathExpression", () => {
|
||||
assert.strictEqual(chef.JPathExpression("{\"key\" : \"value\"}", {query: "$.key"}).toString(), "\"value\"");
|
||||
}),
|
||||
|
Loading…
Reference in New Issue
Block a user