thenavisapp
Version:
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
22 lines (18 loc) • 860 B
text/typescript
import * as fs from 'node:fs';
import * as path from 'node:path';
import { normalizeNewLine } from './common.js';
export function loadSAXParserTestData(): { name: string; src: string; expected: string }[] {
const dataDirPath = new URL('../data/sax', import.meta.url);
const testSetFileDirs = fs.readdirSync(dataDirPath);
return testSetFileDirs.map((dirName) => {
const srcFilePath = path.join(dataDirPath.pathname, dirName, 'src.html');
const expectedFilePath = path.join(dataDirPath.pathname, dirName, 'expected.html');
const src = fs.readFileSync(srcFilePath).toString();
const expected = fs.readFileSync(expectedFilePath).toString();
return {
name: dirName,
src: normalizeNewLine(src),
expected: normalizeNewLine(expected),
};
});
}