Improve use of files as input. Add dish to repl

This commit is contained in:
d98762625 2018-10-05 16:32:12 +01:00
parent 431f1d4be0
commit 25e0585742
4 changed files with 19 additions and 12 deletions

View file

@ -15,6 +15,7 @@ import it from "../assertionHandler";
import chef from "../../../src/node/index";
import OperationError from "../../../src/core/errors/OperationError";
import SyncDish from "../../../src/node/SyncDish";
import fs from "fs";
import { toBase32, Dish } from "../../../src/node/index";
import TestRegister from "../../TestRegister";
@ -349,6 +350,13 @@ TestRegister.addApiTests([
assert.strictEqual(JSONDish.type, 6);
}),
it("Composable dish: Buffer type dishes should be converted to strings", () => {
fs.writeFileSync("test.txt", "abc");
const dish = new Dish(fs.readFileSync("test.txt"));
assert.strictEqual(dish.type, 4);
fs.unlinkSync("test.txt");
}),
it("Excluded operations: throw a sensible error when you try and call one", () => {
try {
chef.fork();