From f1d5f0ab4cd1b83adda9b6da1599582e419d01eb Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Wed, 11 Sep 2024 16:35:01 +0000 Subject: [PATCH] Begin work on suiteLog functionality. --- bin/handlers.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/bin/handlers.js b/bin/handlers.js index afa80a3..09ef23b 100644 --- a/bin/handlers.js +++ b/bin/handlers.js @@ -2,6 +2,7 @@ * Copyright (c) 2024 Digital Bazaar, Inc. */ import {parse, TextNode} from 'node-html-parser'; +import {readFile} from 'node:fs/promises'; class Visitor { constructor({condition, accumulator}) { @@ -18,7 +19,7 @@ class Visitor { } } -export async function checkSpecText({specUrl}) { +export async function checkSpecText({specUrl, suiteLog}) { const specUrls = Array.isArray(specUrl) ? specUrl : [specUrl]; const accumulator = []; const visitor = new Visitor({ @@ -28,9 +29,13 @@ export async function checkSpecText({specUrl}) { for(const url of specUrls) { await parseSpec({url, visitor}); } - console.log(accumulator); + if(suiteLog) { + const log = JSON.parse(await readFile(suiteLog)); + } + //console.log(accumulator); } +// the condition for the spec function textNodeWithMust(node) { if(node instanceof TextNode) { const {text} = node; @@ -41,6 +46,11 @@ function textNodeWithMust(node) { return false; } +// the condition for the test results +function testWithTitle(node) { + +} + async function parseSpec({url, visitor}) { const response = await fetch(url); const html = await response.text();