cyberchef/tests/node/consumers/esm-consumer.mjs
GCHQDeveloper581 e0ba5d2812
fix(node): enable asynchronous operation support in Node.js API (#2342)
Authored-by: engin0223 <engineda2014@hotmail.com>
Changes cherry-picked by GCHQDeveloper581 <63102987+GCHQDeveloper581@users.noreply.github.com>

Breaking change: Alters Node API - "bake" and "execute" are now declared async.
2026-04-27 18:17:24 +01:00

49 lines
916 B
JavaScript

/**
* Tests to ensure that a consuming app can use ESM imports
*
* @author d98762625 [d98762625@gmail.com]
* @copyright Crown Copyright 2019
* @license Apache-2.0
*/
import assert from "assert";
import chef from "cyberchef";
import { bake, toHex, reverse, unique, multiply } from "cyberchef";
const a = await bake("Testing, 1 2 3", [
toHex,
reverse,
{
op: unique,
args: {
delimiter: "Space",
}
},
{
op: multiply,
args: {
delimiter: "Space",
}
}
]);
assert.equal(a.value, "630957449041920");
const b = await chef.bake("Testing, 1 2 3", [
chef.toHex,
chef.reverse,
{
op: chef.unique,
args: {
delimiter: "Space",
}
},
{
op: chef.multiply,
args: {
delimiter: "Space",
}
}
]);
assert.equal(b.value, "630957449041920");