chore: Fix the tests

This commit is contained in:
BluJ
2023-03-28 12:10:13 -06:00
parent 5f9a9ea4ff
commit dc46f9ade4
3 changed files with 49 additions and 599 deletions

View File

@@ -36,6 +36,7 @@ function _mergeDeep<A extends unknown[]>(
return _mergeDeep(target, ...sources);
}
/// Testing the types of the input spec
// @ts-expect-error Because enable should be a boolean
testOutput<InputSpec["rpc"]["enable"], string>()(null);
testOutput<InputSpec["rpc"]["enable"], boolean>()(null);
@@ -45,6 +46,8 @@ testOutput<InputSpec["rpc"]["advanced"]["auth"], string[]>()(null);
testOutput<InputSpec["rpc"]["advanced"]["serialversion"], "segwit" | "non-segwit">()(null);
testOutput<InputSpec["rpc"]["advanced"]["servertimeout"], number>()(null);
testOutput<InputSpec["advanced"]["peers"]["addnode"][0]["hostname"], string>()(null);
/// Here we test the output of the matchInputSpec function
describe("Inputs", () => {
const validInput: InputSpec = {
rpc: {
@@ -104,5 +107,6 @@ describe("Inputs", () => {
expect(() =>
matchInputSpec.unsafeCast(mergeDeep(validInput, { rpc: { advanced: { serialversion: "testing" } } }))
).toThrowError();
matchInputSpec.unsafeCast(validInput);
});
});