mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 23:53:13 +09:00
Fix missing semicolons
Ensure all statements end with a semicolon.
This commit is contained in:
1 parent
34aaeee354
commit
29f066a191
56 files changed
+242
-242
No files matched your search
+19
-19
@@ -97,13 +97,13 @@ describe("lib/config/classes", function() {
|
||||
enum: ["a", "b", "c"],
|
||||
optional: true,
|
||||
initial_value: "b",
|
||||
}
|
||||
};
|
||||
TestGroup.define(field);
|
||||
// Generated properties
|
||||
field.fullName = "test_group.enum";
|
||||
|
||||
assert.deepEqual(TestGroup._definitions.get("enum"), field);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
describe("get definitions", function() {
|
||||
@@ -191,7 +191,7 @@ describe("lib/config/classes", function() {
|
||||
func: 22,
|
||||
bool: null,
|
||||
json: { valid: true },
|
||||
}})
|
||||
}});
|
||||
|
||||
assert.equal(testInstance.get("enum"), "c");
|
||||
assert.equal(testInstance.get("test"), "blah");
|
||||
@@ -218,7 +218,7 @@ describe("lib/config/classes", function() {
|
||||
alpha: null,
|
||||
beta: "decay",
|
||||
gamma: 99,
|
||||
}
|
||||
};
|
||||
|
||||
let testInstance = new TestGroup();
|
||||
await testInstance.load(null, { name: "test_group", fields: testFields });
|
||||
@@ -277,43 +277,43 @@ describe("lib/config/classes", function() {
|
||||
() => testInstance.set("bar", 1),
|
||||
new classes.InvalidField("No field named 'bar'")
|
||||
);
|
||||
})
|
||||
});
|
||||
|
||||
it("should throw if field is not in enum", function() {
|
||||
assert.throws(
|
||||
() => testInstance.set("enum", "bar"),
|
||||
new Error("Expected one of [a, b, c], not bar")
|
||||
);
|
||||
})
|
||||
});
|
||||
|
||||
it("should work if field is in enum", function() {
|
||||
testInstance.set("enum", "c"),
|
||||
assert.equal(testInstance.get("enum"), "c");
|
||||
})
|
||||
});
|
||||
|
||||
it("should throw if field is not optional", function() {
|
||||
assert.throws(
|
||||
() => testInstance.set("func", null),
|
||||
new Error("Field func cannot be null")
|
||||
);
|
||||
})
|
||||
});
|
||||
|
||||
it("should work if field is optional", function() {
|
||||
testInstance.set("test", "spam"),
|
||||
assert.equal(testInstance.get("test"), "spam");
|
||||
})
|
||||
});
|
||||
|
||||
it("should throw if field is of wrong type", function() {
|
||||
assert.throws(
|
||||
() => testInstance.set("test", 1),
|
||||
new Error("Expected type of test to be string, not number")
|
||||
);
|
||||
})
|
||||
});
|
||||
|
||||
it("should treat empty string as null", function() {
|
||||
testInstance.set("test", ""),
|
||||
assert.equal(testInstance.get("test"), null);
|
||||
})
|
||||
});
|
||||
|
||||
it("should auto convert string to boolean if possible", function() {
|
||||
testInstance.set("bool", "true");
|
||||
@@ -374,14 +374,14 @@ describe("lib/config/classes", function() {
|
||||
() => testInstance.setProp("bar", 1),
|
||||
new classes.InvalidField("No field named 'bar'")
|
||||
);
|
||||
})
|
||||
});
|
||||
|
||||
it("should throw if field is not an object", function() {
|
||||
assert.throws(
|
||||
() => testInstance.setProp("enum", "a"),
|
||||
new classes.InvalidField("Cannot set property on non-object field 'enum'")
|
||||
);
|
||||
})
|
||||
});
|
||||
|
||||
it("should work if field is an object", function() {
|
||||
testInstance.set("json", { prev: 32, test: false });
|
||||
@@ -461,7 +461,7 @@ describe("lib/config/classes", function() {
|
||||
await testInstance.init();
|
||||
assert.equal(testInstance.get("alpha.foo"), null);
|
||||
assert.deepEqual(testInstance.get("beta.bar"), {});
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
describe(".serialize()", function() {
|
||||
@@ -480,7 +480,7 @@ describe("lib/config/classes", function() {
|
||||
}
|
||||
]
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
describe(".load()", function() {
|
||||
@@ -522,7 +522,7 @@ describe("lib/config/classes", function() {
|
||||
name: "beta",
|
||||
fields: { bar: { value: 20 }},
|
||||
}
|
||||
]
|
||||
];
|
||||
|
||||
let testInstance = new TestConfig();
|
||||
await testInstance.load({ groups: testGroups });
|
||||
@@ -562,7 +562,7 @@ describe("lib/config/classes", function() {
|
||||
}
|
||||
],
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
describe(".group()", function() {
|
||||
@@ -580,14 +580,14 @@ describe("lib/config/classes", function() {
|
||||
let testInstance = new TestConfig();
|
||||
await testInstance.init();
|
||||
|
||||
assert.throws(() => testInstance.get("invalid"), new Error("No config group named 'invalid'"))
|
||||
assert.throws(() => testInstance.get("invalid"), new Error("No config group named 'invalid'"));
|
||||
});
|
||||
|
||||
it("should throw if no field is specified", async function() {
|
||||
let testInstance = new TestConfig();
|
||||
await testInstance.init();
|
||||
|
||||
assert.throws(() => testInstance.get("alpha"), new Error("No field named ''"))
|
||||
assert.throws(() => testInstance.get("alpha"), new Error("No field named ''"));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user