chore: Update and fix config type test

This commit is contained in:
BluJ
2023-04-03 13:41:25 -06:00
parent 2d835e0a9f
commit 82e96eb18e
4 changed files with 30 additions and 5 deletions

View File

@@ -0,0 +1,25 @@
import {
ListValueSpecOf,
ValueSpecList,
isValueSpecListOf,
} from "../config-types";
import { Config } from "./config";
import { List } from "./list";
import { Value } from "./value";
describe("Config Types", () => {
test("isValueSpecListOf", () => {
const options = [List.obj, List.string, List.number];
for (const option of options) {
const test = option({} as any, { spec: Config.of({}) } as any) as any;
const someList = Value.list(test).build();
if (isValueSpecListOf(someList, "string")) {
someList.spec satisfies ListValueSpecOf<"string">;
} else if (isValueSpecListOf(someList, "number")) {
someList.spec satisfies ListValueSpecOf<"number">;
} else if (isValueSpecListOf(someList, "object")) {
someList.spec satisfies ListValueSpecOf<"object">;
}
}
});
});