fix: make Avro to JSON and Bzip2 Compress resolve through the Node API (#2658)
This commit is contained in:
parent
002ed911b1
commit
4a52ebaeb8
@ -39,7 +39,7 @@ class AvroToJSON extends Operation {
|
|||||||
* @param {Object[]} args
|
* @param {Object[]} args
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
run(input, args) {
|
async run(input, args) {
|
||||||
if (input.byteLength <= 0) {
|
if (input.byteLength <= 0) {
|
||||||
throw new OperationError("Please provide an input.");
|
throw new OperationError("Please provide an input.");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,7 +47,7 @@ class Bzip2Compress extends Operation {
|
|||||||
* @param {Object[]} args
|
* @param {Object[]} args
|
||||||
* @returns {File}
|
* @returns {File}
|
||||||
*/
|
*/
|
||||||
run(input, args) {
|
async run(input, args) {
|
||||||
const [blockSize, workFactor] = args;
|
const [blockSize, workFactor] = args;
|
||||||
if (input.byteLength <= 0) {
|
if (input.byteLength <= 0) {
|
||||||
throw new OperationError("Please provide an input.");
|
throw new OperationError("Please provide an input.");
|
||||||
|
|||||||
@ -264,6 +264,18 @@ Full hash: $2a$10$ODeP1.6fMsb.ENk2ngPUCO7qTGVPyHA9TqDVcyupyed8FjsiF65L6`;
|
|||||||
assert.strictEqual(result.toString(), "Fit as a Fiddle");
|
assert.strictEqual(result.toString(), "Fit as a Fiddle");
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
it("Bzip2 Compress: round-trips through the Node API", async () => {
|
||||||
|
const compressed = await chef.bzip2Compress("The quick brown fox.");
|
||||||
|
const result = await chef.bzip2Decompress(compressed);
|
||||||
|
assert.strictEqual(result.toString(), "The quick brown fox.");
|
||||||
|
}),
|
||||||
|
|
||||||
|
it("Avro to JSON: decodes an object container file through the Node API", async () => {
|
||||||
|
const avro = chef.fromHex("4f626a0104166176726f2e736368656d6196017b2274797065223a227265636f7264222c226e616d65223a22736d616c6c222c226669656c6473223a5b7b226e616d65223a226e616d65222c2274797065223a22737472696e67227d5d7d146176726f2e636f646563086e756c6c004e0247632e3702e5b75cdab9a62f1541020e0c6d796e616d654e0247632e3702e5b75cdab9a62f1541");
|
||||||
|
const result = await chef.avroToJSON(avro);
|
||||||
|
assert.strictEqual(result.toString(), "{\n \"name\": \"myname\"\n}");
|
||||||
|
}),
|
||||||
|
|
||||||
it("cartesianProduct: binary string", () => {
|
it("cartesianProduct: binary string", () => {
|
||||||
const result = cartesianProduct("1:2\\n\\n3:4", {
|
const result = cartesianProduct("1:2\\n\\n3:4", {
|
||||||
itemDelimiter: ":",
|
itemDelimiter: ":",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user