Page MenuHomeSealhub

list.test.ts
No OneTemporary

list.test.ts

import { FileManager } from "@sealcode/file-manager";
import { makeSimpleEnglishJDDContext } from "../jdd-context.js";
import { ExtractParsed } from "./component-argument.js";
import { Image } from "./image.js";
import { List } from "./list.js";
import { ShortText } from "./short-text.js";
import assert from "assert";
describe("list", () => {
it("allows for creating a list of images", () => {
new List(new Image());
});
it("properly parses list arguments", () => {
const images_arg = new List(new Image());
const images = [] as ExtractParsed<typeof images_arg>;
images.map((e) => e?.file_manager); // if the types are right, this should typecheck OK
const strings_arg = new List(new ShortText()).setExampleValues([
["a tag"],
]);
const strings = [] as ExtractParsed<typeof strings_arg>;
strings.map((e) => e?.padStart(0)); // if the types are right, this should typecheck OK
});
it("handles undefined value", async () => {
const strings_arg = new List(new ShortText());
const value = await strings_arg.receivedToParsed(
makeSimpleEnglishJDDContext(
new FileManager("/tmp", "/uploaded_files")
),
undefined
);
assert(Array.isArray(value));
assert(value.length == 0);
});
});

File Metadata

Mime Type
text/x-java
Expires
Tue, Dec 24, 14:05 (9 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
557307
Default Alt Text
list.test.ts (1 KB)

Event Timeline