Files
factorio-clusterio/test/lib/hash.js
T
Hornwitser bf5a4a8a9c Split up into multiple packages with Lerna
Split up codebase into the packages @clsterio/lib, @clusterio/master,
@clusterio/slave, and @clusterio/ctl using lerna to manage them.  This
will allow deployment to use only the parts needed reducing install
size, and better separate the code into shared library, master, slave
and control.
2020-09-21 18:00:07 +02:00

26 lines
770 B
JavaScript

"use strict";
const assert = require("assert").strict;
const fs = require("fs");
const path = require("path");
const stream = require("stream");
const hash = require("@clusterio/lib/hash");
describe("lib/hash", function() {
describe("hashStream()", function() {
it("should hash a stream of bytes", async function() {
let stream = fs.createReadStream(path.join("test", "file", "hash.txt"));
let result = await hash.hashStream(stream);
assert.equal(result, "be417768b5c3c5c1d9bcb2e7c119196dd76b5570");
});
});
describe("hashFile()", function() {
it("should hash a file", async function() {
let result = await hash.hashFile(path.join("test", "file", "hash.txt"));
assert.equal(result, "be417768b5c3c5c1d9bcb2e7c119196dd76b5570");
});
});
});