From 0edd3e1825e1e58b043be9c2d4e98df471c4d088 Mon Sep 17 00:00:00 2001 From: Martin Forstner Date: Mon, 17 May 2021 21:03:06 +0200 Subject: [PATCH] fix: array in files --- lib/utils/save-results-to-file.ts | 5 ++--- tests/a11y-sitechecker-bin.spec.ts | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/utils/save-results-to-file.ts b/lib/utils/save-results-to-file.ts index ca8c9d3..a1a7235 100644 --- a/lib/utils/save-results-to-file.ts +++ b/lib/utils/save-results-to-file.ts @@ -68,14 +68,13 @@ export async function saveResultsToFile(config: Config, sitecheckerResult: A11yS date: new Date(), files: [fileToSave], }; - fileObject = [{ _id: id, url: url, filesByDate: [fileResult] }]; + fileObject = new Array({ _id: id, url: url, filesByDate: [fileResult] }); } const siteResult = setupSiteresult(id, sitecheckerResult); - fileObject = []; defineExtraTags(sitecheckerResult, config); fs.writeFileSync(fileToSave, JSON.stringify(siteResult, null, 4)); - fs.writeFileSync(config.resultsPath + 'files.json', JSON.stringify({fileObject}, null, 4)); + fs.writeFileSync(config.resultsPath + 'files.json', JSON.stringify(fileObject, null, 4)); const violationsPath = config.resultsPathPerUrl + diff --git a/tests/a11y-sitechecker-bin.spec.ts b/tests/a11y-sitechecker-bin.spec.ts index b9d6ba5..0e03c89 100644 --- a/tests/a11y-sitechecker-bin.spec.ts +++ b/tests/a11y-sitechecker-bin.spec.ts @@ -16,7 +16,7 @@ describe('a11y-sitechecker-bin', function () { }); it('should exit with code 0', (done) => { - const url = 'www.forsti.eu'; + const url = 'https://www.forsti.eu'; const jobSpawn = job.spawn('node', [ './dist/bin/a11y-sitechecker.js', url,