{"size": 1450, "ext": "js", "max_stars_repo_path": "test/node-cjs-test.js", "max_stars_repo_name": "Amphiluke/lindsvg", "max_stars_repo_stars_event_min_datetime": "2021-09-20T08:51:37.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-10T03:58:05.000Z", "max_issues_repo_path": "test/node-cjs-test.js", "max_issues_repo_name": "Amphiluke/lindsvg", "max_issues_repo_issues_event_min_datetime": "2021-05-11T15:26:08.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-11T15:26:08.000Z", "max_forks_repo_path": "test/node-cjs-test.js", "max_forks_repo_name": "Amphiluke/lindsvg", "max_forks_repo_forks_event_min_datetime": "2021-09-20T08:51:40.000Z", "max_forks_repo_forks_event_max_datetime": "2021-12-30T08:30:47.000Z"}
{"max_stars_count": 3, "max_issues_count": 1, "max_forks_count": 2, "avg_line_length": 37.1794871795, "max_line_length": 137, "alphanum_fraction": 0.6944827586}
let {getSVGCode, getMultiPathSVGCode} = require("../dist/lindsvg.js");
let {promisify} = require("util");
let {writeFile, unlink} = require("fs");
let {join} = require("path");
let {dump} = require("js-yaml");

let asyncWriteFile = promisify(writeFile);
let asyncUnlink = promisify(unlink);

async function runTest() {
    let {singlePathLSParams, multiPathLSParams, lsInvalidParams, singlePathSVGParams, multiPathSVGParams} = await import("./params.mjs");

    let singlePathSVG = join(__dirname, "svg", "single-path.svg");
    let multiPathSVG = join(__dirname, "svg", "multi-path.svg");

    await Promise.allSettled([asyncUnlink(singlePathSVG), asyncUnlink(multiPathSVG)]);

    let singlePathSVGCode = getSVGCode(singlePathLSParams, singlePathSVGParams);
    await asyncWriteFile(singlePathSVG, singlePathSVGCode);

    let multiPathSVGCode = getMultiPathSVGCode(multiPathLSParams, multiPathSVGParams);
    await asyncWriteFile(multiPathSVG, multiPathSVGCode);

    try {
        console.log("Below, an exception is expected");
        console.log(getMultiPathSVGCode(lsInvalidParams, multiPathSVGParams));
    } catch (error) {
        // Log the original message
        console.error(error);
        if (error.name === "LSError") {
            // Get a JSON representation of the error list and format it as YAML
            let errorJSON = error.toJSON();
            console.log(dump(errorJSON, {indent: 4}));
        }
    }
}

runTest();
