mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-26 10:21:55 +00:00
chore: update
This commit is contained in:
18
lib/test/output.test.ts
Normal file
18
lib/test/output.test.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { InputSpec, matchInputSpec } from "./output";
|
||||
|
||||
type TEqual<A, B> = A extends B ? (B extends A ? null : never) : never;
|
||||
function testOutput<A, B>(): (c: TEqual<A, B>) => null {
|
||||
return () => null;
|
||||
}
|
||||
const testValue = null as unknown;
|
||||
// @ts-expect-error Because enable should be a boolean
|
||||
testOutput<InputSpec["rpc"]["enable"], string>()(null);
|
||||
testOutput<InputSpec["rpc"]["enable"], boolean>()(null);
|
||||
testOutput<InputSpec["rpc"]["username"], string>()(null);
|
||||
|
||||
// testOutput<InputSpec["rpc"]["advanced"]["auth"], string[]>()(null);
|
||||
describe("Inputs", () => {
|
||||
test("test", () => {
|
||||
expect(true).toEqual(true);
|
||||
});
|
||||
});
|
||||
@@ -166,13 +166,13 @@ export function matchNumberWithRange(range: string) {
|
||||
leftValue === "*"
|
||||
? (_) => true
|
||||
: left === "["
|
||||
? (x) => x >= Number(leftValue)
|
||||
: (x) => x > Number(leftValue),
|
||||
? (x) => x >= Number(leftValue)
|
||||
: (x) => x > Number(leftValue),
|
||||
leftValue === "*"
|
||||
? "any"
|
||||
: left === "["
|
||||
? `greaterThanOrEqualTo${leftValue}`
|
||||
: `greaterThan${leftValue}`
|
||||
? `greaterThanOrEqualTo${leftValue}`
|
||||
: `greaterThan${leftValue}`
|
||||
)
|
||||
.validate(
|
||||
// prettier-ignore
|
||||
|
||||
Reference in New Issue
Block a user