Skip to content

Commit

Permalink
Begin work on suiteLog functionality.
Browse files Browse the repository at this point in the history
  • Loading branch information
aljones15 committed Sep 11, 2024
1 parent 7f3cff7 commit f1d5f0a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions bin/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}) {
Expand All @@ -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({
Expand All @@ -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));

Check failure on line 33 in bin/handlers.js

View workflow job for this annotation

GitHub Actions / lint (20.x)

'log' is assigned a value but never used
}
//console.log(accumulator);
}

// the condition for the spec
function textNodeWithMust(node) {
if(node instanceof TextNode) {
const {text} = node;
Expand All @@ -41,6 +46,11 @@ function textNodeWithMust(node) {
return false;
}

// the condition for the test results
function testWithTitle(node) {

Check failure on line 50 in bin/handlers.js

View workflow job for this annotation

GitHub Actions / lint (20.x)

'testWithTitle' is defined but never used

Check failure on line 50 in bin/handlers.js

View workflow job for this annotation

GitHub Actions / lint (20.x)

'node' is defined but never used

}

async function parseSpec({url, visitor}) {
const response = await fetch(url);
const html = await response.text();
Expand Down

0 comments on commit f1d5f0a

Please sign in to comment.