mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 23:04:52 +09:00
Move all functions and classes currently available through lib/name and libName to be under a single flat namespace in lib. This make reorganising the lib namespace much simpler as the location of symbols can move without breaking the consumers of lib. The multi-entrypoint design was already problematic for the web plugin system which couldn't effectively use it due to how webpack's shared module system is awkward to set up with multiple entrypoints per package.
25 lines
728 B
JavaScript
25 lines
728 B
JavaScript
"use strict";
|
|
const assert = require("assert").strict;
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
const lib = require("@clusterio/lib");
|
|
|
|
|
|
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 lib.hashStream(stream);
|
|
assert.equal(result, "be417768b5c3c5c1d9bcb2e7c119196dd76b5570");
|
|
});
|
|
});
|
|
|
|
describe("hashFile()", function() {
|
|
it("should hash a file", async function() {
|
|
let result = await lib.hashFile(path.join("test", "file", "hash.txt"));
|
|
assert.equal(result, "be417768b5c3c5c1d9bcb2e7c119196dd76b5570");
|
|
});
|
|
});
|
|
});
|