Prefix clusterio/lib imports with lib

Use lib* prefix for the modules impored from the lib package to help
distinguish them more from ordinary variables.  Fix up the naming
convention for files to be consistently lowercase_underscore for
JavaScript files.
This commit is contained in:
Hornwitser committed 2020-10-23 21:22:43 +02:00
1 parent fbbaf3dd3a
commit 24397b75cc
55 files changed
+692 -668

No files matched your search

+7 -7
View File
@@ -2,9 +2,9 @@
const assert = require("assert").strict;
const events = require("events");
const link = require("@clusterio/lib/link");
const errors = require("@clusterio/lib/errors");
const schema = require("@clusterio/lib/schema");
const libLink = require("@clusterio/lib/link");
const libErrors = require("@clusterio/lib/errors");
const libSchema = require("@clusterio/lib/schema");
const mock = require("../../mock");
@@ -15,8 +15,8 @@ describe("lib/link/link", function() {
before(function() {
testConnector = new mock.MockConnector();
testLink = new link.Link("source", "target", testConnector);
testLink.setValidator("simple", schema.compile({
testLink = new libLink.Link("source", "target", testConnector);
testLink.setValidator("simple", libSchema.compile({
properties: {
"data": {
type: "object",
@@ -78,7 +78,7 @@ describe("lib/link/link", function() {
it("should throw on message without validator", function() {
assert.throws(
() => testLink.processMessage({ seq: 1, type: "no_validator", data: {} }),
new errors.InvalidMessage("No validator for no_validator on source-target")
new libErrors.InvalidMessage("No validator for no_validator on source-target")
);
});
it("should throw on message failing validation", function() {
@@ -90,7 +90,7 @@ describe("lib/link/link", function() {
it("should throw on unhandled message", function() {
assert.throws(
() => testLink.processMessage({ seq: 1, type: "simple", data: { string: "a" }}),
new errors.InvalidMessage("Unhandled message simple")
new libErrors.InvalidMessage("Unhandled message simple")
);
});
});