MCPcopy
hub / github.com/loggerhead/json4u / doExpect

Function doExpect

__tests__/parseAndFormat.test.ts:14–24  ·  view source on GitHub ↗
(options: Partial<ParseOptions>, text: string, ...aa: TestData[])

Source from the content-addressed store, hash-verified

12}
13
14async function doExpect(options: Partial<ParseOptions>, text: string, ...aa: TestData[]) {
15 const { treeObject } = await parseAndFormat(text, {
16 ...options,
17 kind: "main",
18 });
19 const tree = Tree.fromObject(treeObject);
20
21 expect(tree.hasError()).toEqual(false);
22 expectOffsetAndText(tree, aa);
23 expectFindNodeAtOffset(tree, aa);
24}
25
26function expectOffsetAndText(tree: Tree, aa: TestData[]) {
27 for (const { id, offset, length, boundOffset, boundLength } of aa) {

Callers 1

Calls 5

parseAndFormatFunction · 0.90
expectOffsetAndTextFunction · 0.85
expectFindNodeAtOffsetFunction · 0.85
fromObjectMethod · 0.80
hasErrorMethod · 0.80

Tested by

no test coverage detected