@qualweb/earl-reporter
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -11,3 +11,3 @@ 'use strict'; | ||
const best_practices_reporter_1 = __importDefault(require("./lib/best-practices.reporter")); | ||
async function generateEarlAssertions(report, date) { | ||
async function generateEARLAssertions(report, date) { | ||
switch (report.type) { | ||
@@ -26,4 +26,23 @@ case 'act-rules': | ||
} | ||
exports.generateEarlAssertions = generateEarlAssertions; | ||
async function generateSingleEarlReport(report) { | ||
exports.generateEARLAssertions = generateEARLAssertions; | ||
function reportModule(module, options) { | ||
if (!options || !options.modules) { | ||
return true; | ||
} | ||
else { | ||
switch (module) { | ||
case 'act': | ||
return !!options.modules.act; | ||
case 'html': | ||
return !!options.modules.html; | ||
case 'css': | ||
return !!options.modules.css; | ||
case 'best-practices': | ||
return !!options.modules['best-practices']; | ||
default: | ||
return false; | ||
} | ||
} | ||
} | ||
async function generateSingleEarlReport(report, options) { | ||
const earlReport = { | ||
@@ -47,24 +66,24 @@ context: 'https://act-rules.github.io/earl-context.json', | ||
}; | ||
if (report.modules['act-rules']) { | ||
if (report.modules['act-rules'] && reportModule('act', options)) { | ||
testSubject.assertions = [ | ||
...testSubject.assertions, | ||
...(await generateEarlAssertions(report.modules['act-rules'], report.system.date)) | ||
...(await generateEARLAssertions(report.modules['act-rules'], report.system.date)) | ||
]; | ||
} | ||
if (report.modules['html-techniques']) { | ||
if (report.modules['html-techniques'] && reportModule('html', options)) { | ||
testSubject.assertions = [ | ||
...testSubject.assertions, | ||
...(await generateEarlAssertions(report.modules['html-techniques'], report.system.date)) | ||
...(await generateEARLAssertions(report.modules['html-techniques'], report.system.date)) | ||
]; | ||
} | ||
if (report.modules['css-techniques']) { | ||
if (report.modules['css-techniques'] && reportModule('css', options)) { | ||
testSubject.assertions = [ | ||
...testSubject.assertions, | ||
...(await generateEarlAssertions(report.modules['css-techniques'], report.system.date)) | ||
...(await generateEARLAssertions(report.modules['css-techniques'], report.system.date)) | ||
]; | ||
} | ||
if (report.modules['best-practices']) { | ||
if (report.modules['best-practices'] && reportModule('best-practices', options)) { | ||
testSubject.assertions = [ | ||
...testSubject.assertions, | ||
...(await generateEarlAssertions(report.modules['best-practices'], report.system.date)) | ||
...(await generateEARLAssertions(report.modules['best-practices'], report.system.date)) | ||
]; | ||
@@ -75,4 +94,3 @@ } | ||
} | ||
exports.generateSingleEarlReport = generateSingleEarlReport; | ||
async function generateAggregatedEarlReport(reports) { | ||
async function generateAggregatedEarlReport(reports, options) { | ||
const aggregatedReport = { | ||
@@ -83,3 +101,3 @@ context: 'https://act-rules.github.io/earl-context.json', | ||
for (const report of reports || []) { | ||
const earlReport = await generateSingleEarlReport(report); | ||
const earlReport = await generateSingleEarlReport(report, options); | ||
aggregatedReport.graph.push(cloneDeep_1.default(earlReport.graph[0])); | ||
@@ -89,2 +107,15 @@ } | ||
} | ||
exports.generateAggregatedEarlReport = generateAggregatedEarlReport; | ||
async function generateEARLReport(reports, options) { | ||
if (options && options.aggregated) { | ||
return [await generateAggregatedEarlReport(reports, options)]; | ||
} | ||
else { | ||
const earlReports = new Array(); | ||
for (const report of reports || []) { | ||
const earlReport = await generateSingleEarlReport(report, options); | ||
earlReports.push(cloneDeep_1.default(earlReport)); | ||
} | ||
return cloneDeep_1.default(earlReports); | ||
} | ||
} | ||
exports.generateEARLReport = generateEARLReport; |
{ | ||
"name": "@qualweb/earl-reporter", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Qualweb earl reporter", | ||
@@ -28,3 +28,3 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@qualweb/types": "0.0.24", | ||
"@qualweb/types": "0.0.27", | ||
"@types/css": "0.0.31", | ||
@@ -31,0 +31,0 @@ "@types/htmlparser2": "^3.10.1", |
@@ -10,3 +10,4 @@ 'use strict'; | ||
Assertor, | ||
Assertion | ||
Assertion, | ||
EarlOptions | ||
} from '@qualweb/earl-reporter'; | ||
@@ -19,3 +20,3 @@ | ||
async function generateEarlAssertions(report: Report, date?: string): Promise<Assertion[]> { | ||
async function generateEARLAssertions(report: Report, date?: string): Promise<Assertion[]> { | ||
switch(report.type) { | ||
@@ -35,4 +36,23 @@ case 'act-rules': | ||
async function generateSingleEarlReport(report: EvaluationReport): Promise<EarlReport> { | ||
function reportModule(module: string, options?: EarlOptions): boolean { | ||
if (!options || !options.modules) { | ||
return true; | ||
} else { | ||
switch(module) { | ||
case 'act': | ||
return !!options.modules.act; | ||
case 'html': | ||
return !!options.modules.html; | ||
case 'css': | ||
return !!options.modules.css; | ||
case 'best-practices': | ||
return !!options.modules['best-practices']; | ||
default: | ||
return false | ||
} | ||
} | ||
} | ||
async function generateSingleEarlReport(report: EvaluationReport, options?: EarlOptions): Promise<EarlReport> { | ||
const earlReport: EarlReport = { | ||
@@ -59,24 +79,24 @@ context: 'https://act-rules.github.io/earl-context.json', | ||
if (report.modules['act-rules']) { | ||
if (report.modules['act-rules'] && reportModule('act', options)) { | ||
testSubject.assertions = [ | ||
...testSubject.assertions, | ||
...(await generateEarlAssertions(report.modules['act-rules'], report.system.date)) | ||
...(await generateEARLAssertions(report.modules['act-rules'], report.system.date)) | ||
]; | ||
} | ||
if (report.modules['html-techniques']) { | ||
if (report.modules['html-techniques'] && reportModule('html', options)) { | ||
testSubject.assertions = [ | ||
...testSubject.assertions, | ||
...(await generateEarlAssertions(report.modules['html-techniques'], report.system.date)) | ||
...(await generateEARLAssertions(report.modules['html-techniques'], report.system.date)) | ||
]; | ||
} | ||
if (report.modules['css-techniques']) { | ||
if (report.modules['css-techniques'] && reportModule('css', options)) { | ||
testSubject.assertions = [ | ||
...testSubject.assertions, | ||
...(await generateEarlAssertions(report.modules['css-techniques'], report.system.date)) | ||
...(await generateEARLAssertions(report.modules['css-techniques'], report.system.date)) | ||
]; | ||
} | ||
if (report.modules['best-practices']) { | ||
if (report.modules['best-practices'] && reportModule('best-practices', options)) { | ||
testSubject.assertions = [ | ||
...testSubject.assertions, | ||
...(await generateEarlAssertions(report.modules['best-practices'], report.system.date)) | ||
...(await generateEARLAssertions(report.modules['best-practices'], report.system.date)) | ||
]; | ||
@@ -90,3 +110,3 @@ } | ||
async function generateAggregatedEarlReport(reports: EvaluationReport[]): Promise<EarlReport> { | ||
async function generateAggregatedEarlReport(reports: EvaluationReport[], options?: EarlOptions): Promise<EarlReport> { | ||
const aggregatedReport: EarlReport = { | ||
@@ -98,3 +118,3 @@ context: 'https://act-rules.github.io/earl-context.json', | ||
for (const report of reports || []) { | ||
const earlReport = await generateSingleEarlReport(report); | ||
const earlReport = await generateSingleEarlReport(report, options); | ||
aggregatedReport.graph.push(cloneDeep(earlReport.graph[0])); | ||
@@ -106,6 +126,18 @@ } | ||
async function generateEARLReport(reports: Array<EvaluationReport>, options?: EarlOptions): Promise<Array<EarlReport>> { | ||
if (options && options.aggregated) { | ||
return [await generateAggregatedEarlReport(reports, options)]; | ||
} else { | ||
const earlReports = new Array<EarlReport>(); | ||
for (const report of reports || []) { | ||
const earlReport = await generateSingleEarlReport(report, options); | ||
earlReports.push(cloneDeep(earlReport)); | ||
} | ||
return cloneDeep(earlReports); | ||
} | ||
} | ||
export { | ||
generateEarlAssertions, | ||
generateSingleEarlReport, | ||
generateAggregatedEarlReport | ||
generateEARLAssertions, | ||
generateEARLReport | ||
}; |
@@ -273,13 +273,13 @@ const { expect } = require('chai'); | ||
it('should exist', async function () { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl)).to.be.an('array').and.to.include('context'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0])).to.be.an('array').and.to.include('context'); | ||
}); | ||
it('should not be empty', async function () { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.context.trim()).to.be.not.equal(''); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].context.trim()).to.be.not.equal(''); | ||
}); | ||
it('should be valid', async function () { | ||
this.timeout(10 * 1000); | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
const contextUrl = earl.context.trim(); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
const contextUrl = earl[0].context.trim(); | ||
const options = { | ||
@@ -298,16 +298,16 @@ method: 'GET', | ||
it('should exists', async function () { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl)).to.be.an('array').and.to.include('graph'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0])).to.be.an('array').and.to.include('graph'); | ||
}); | ||
it('should be of type array', async function () { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph).to.be.an('array'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph).to.be.an('array'); | ||
}); | ||
it('should not be empty', async function () { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph.length).to.be.not.equal(0); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph.length).to.be.not.equal(0); | ||
}); | ||
it('should have only one test subject', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph.length).to.be.equal(1); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph.length).to.be.equal(1); | ||
}); | ||
@@ -317,16 +317,16 @@ describe('"Test subject" field', function() { | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0])).to.be.an('array').and.to.include('@type'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0])).to.be.an('array').and.to.include('@type'); | ||
}); | ||
it('should be of type string', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0]['@type']).to.be.a('string'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0]['@type']).to.be.a('string'); | ||
}); | ||
it('should not be empty', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0]['@type'].trim()).to.not.be.equal(''); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0]['@type'].trim()).to.not.be.equal(''); | ||
}); | ||
it('should be "TestSubject"', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0]['@type'].trim()).to.be.equal('TestSubject'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0]['@type'].trim()).to.be.equal('TestSubject'); | ||
}); | ||
@@ -336,12 +336,12 @@ }); | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0])).to.be.an('array').and.to.include('source'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0])).to.be.an('array').and.to.include('source'); | ||
}); | ||
it('should be of type string', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0]['source']).to.be.a('string'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0]['source']).to.be.a('string'); | ||
}); | ||
it('should not be empty', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0]['source'].trim()).to.not.be.equal(''); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0]['source'].trim()).to.not.be.equal(''); | ||
}); | ||
@@ -351,17 +351,17 @@ }); | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0])).to.be.an('array').and.to.include('assertor'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0])).to.be.an('array').and.to.include('assertor'); | ||
}) | ||
describe('"@id" field', function() { | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0].assertor)).to.be.an('array').and.to.include('@id'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0].assertor)).to.be.an('array').and.to.include('@id'); | ||
}); | ||
it('should be of type string', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertor['@id']).to.be.a('string'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertor['@id']).to.be.a('string'); | ||
}); | ||
it('should not be empty', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertor['@id'].trim()).to.not.be.equal(''); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertor['@id'].trim()).to.not.be.equal(''); | ||
}); | ||
@@ -371,16 +371,16 @@ }); | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0].assertor)).to.be.an('array').and.to.include('@type'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0].assertor)).to.be.an('array').and.to.include('@type'); | ||
}); | ||
it('should be of type string', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertor['@type']).to.be.a('string'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertor['@type']).to.be.a('string'); | ||
}); | ||
it('should not be empty', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertor['@type'].trim()).to.not.be.equal(''); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertor['@type'].trim()).to.not.be.equal(''); | ||
}); | ||
it('should be "Software"', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertor['@type'].trim()).to.be.equal('Software'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertor['@type'].trim()).to.be.equal('Software'); | ||
}); | ||
@@ -390,12 +390,12 @@ }); | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0].assertor)).to.be.an('array').and.to.include('title'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0].assertor)).to.be.an('array').and.to.include('title'); | ||
}); | ||
it('should be of type string', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertor['title']).to.be.a('string'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertor['title']).to.be.a('string'); | ||
}); | ||
it('should not be empty', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertor['title'].trim()).to.not.be.equal(''); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertor['title'].trim()).to.not.be.equal(''); | ||
}); | ||
@@ -405,12 +405,12 @@ }); | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0].assertor)).to.be.an('array').and.to.include('description'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0].assertor)).to.be.an('array').and.to.include('description'); | ||
}); | ||
it('should be of type string', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertor['description']).to.be.a('string'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertor['description']).to.be.a('string'); | ||
}); | ||
it('should not be empty', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertor['description'].trim()).to.not.be.equal(''); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertor['description'].trim()).to.not.be.equal(''); | ||
}); | ||
@@ -420,12 +420,12 @@ }); | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0].assertor)).to.be.an('array').and.to.include('hasVersion'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0].assertor)).to.be.an('array').and.to.include('hasVersion'); | ||
}); | ||
it('should be of type string', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertor['hasVersion']).to.be.a('string'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertor['hasVersion']).to.be.a('string'); | ||
}); | ||
it('should not be empty', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertor['hasVersion'].trim()).to.not.be.equal(''); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertor['hasVersion'].trim()).to.not.be.equal(''); | ||
}); | ||
@@ -435,12 +435,12 @@ }); | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0].assertor)).to.be.an('array').and.to.include('homepage'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0].assertor)).to.be.an('array').and.to.include('homepage'); | ||
}); | ||
it('should be of type string', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertor['homepage']).to.be.a('string'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertor['homepage']).to.be.a('string'); | ||
}); | ||
it('should not be empty', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertor['homepage'].trim()).to.not.be.equal(''); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertor['homepage'].trim()).to.not.be.equal(''); | ||
}); | ||
@@ -451,12 +451,12 @@ }); | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0])).to.be.an('array').and.to.include('assertions'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0])).to.be.an('array').and.to.include('assertions'); | ||
}); | ||
it('should be of type array', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions).to.be.an('array'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions).to.be.an('array'); | ||
}); | ||
it('should not be empty', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions.length).to.not.be.equal(0); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions.length).to.not.be.equal(0); | ||
}); | ||
@@ -467,4 +467,4 @@ it('should have number of assertions equal to the same amount of tests done', async function() { | ||
(evaluationReport.modules['css-techniques'] ? Object.keys(evaluationReport.modules['css-techniques'].techniques).length : 0); | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions.length).to.be.equal(nAssertions); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions.length).to.be.equal(nAssertions); | ||
}); | ||
@@ -474,16 +474,16 @@ describe('"assertion" field', function() { | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0].assertions[0])).to.include('@type'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0].assertions[0])).to.include('@type'); | ||
}); | ||
it('should be of type string', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0]['@type']).to.be.a('string'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0]['@type']).to.be.a('string'); | ||
}); | ||
it('should not be empty', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0]['@type'].trim()).to.not.be.equal(''); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0]['@type'].trim()).to.not.be.equal(''); | ||
}); | ||
it('should be "Assertion"', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0]['@type'].trim()).to.be.equal('Assertion'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0]['@type'].trim()).to.be.equal('Assertion'); | ||
}); | ||
@@ -493,17 +493,17 @@ }); | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0].assertions[0])).to.include('test'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0].assertions[0])).to.include('test'); | ||
}); | ||
describe('"@id" field', function() { | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0].assertions[0].test)).to.include('@id'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0].assertions[0].test)).to.include('@id'); | ||
}); | ||
it('should be of type string', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0].test['@id']).to.be.a('string'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0].test['@id']).to.be.a('string'); | ||
}); | ||
it('should not be empty', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0].test['@id'].trim()).to.not.be.equal(''); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0].test['@id'].trim()).to.not.be.equal(''); | ||
}); | ||
@@ -513,16 +513,16 @@ }); | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0].assertions[0].test)).to.include('@type'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0].assertions[0].test)).to.include('@type'); | ||
}); | ||
it('should be of type string', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0].test['@type']).to.be.a('string'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0].test['@type']).to.be.a('string'); | ||
}); | ||
it('should not be empty', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0].test['@type'].trim()).to.not.be.equal(''); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0].test['@type'].trim()).to.not.be.equal(''); | ||
}); | ||
it('should be "TestCase"', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0].test['@type'].trim()).to.be.equal('TestCase'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0].test['@type'].trim()).to.be.equal('TestCase'); | ||
}); | ||
@@ -532,12 +532,12 @@ }); | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0].assertions[0].test)).to.include('title'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0].assertions[0].test)).to.include('title'); | ||
}); | ||
it('should be of type string', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0].test['title']).to.be.a('string'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0].test['title']).to.be.a('string'); | ||
}); | ||
it('should not be empty', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0].test['title'].trim()).to.not.be.equal(''); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0].test['title'].trim()).to.not.be.equal(''); | ||
}); | ||
@@ -547,12 +547,12 @@ }); | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0].assertions[0].test)).to.include('description'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0].assertions[0].test)).to.include('description'); | ||
}); | ||
it('should be of type string', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0].test['description']).to.be.a('string'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0].test['description']).to.be.a('string'); | ||
}); | ||
it('should not be empty', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0].test['description'].trim()).to.not.be.equal(''); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0].test['description'].trim()).to.not.be.equal(''); | ||
}); | ||
@@ -563,16 +563,16 @@ }); | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0].assertions[0])).to.include('mode'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0].assertions[0])).to.include('mode'); | ||
}); | ||
it('should be of type string', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0]['mode']).to.be.a('string'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0]['mode']).to.be.a('string'); | ||
}); | ||
it('should not be empty', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0]['mode'].trim()).to.not.be.equal(''); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0]['mode'].trim()).to.not.be.equal(''); | ||
}); | ||
it('should be "earl:automatic"', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0]['mode'].trim()).to.be.equal('earl:automatic'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0]['mode'].trim()).to.be.equal('earl:automatic'); | ||
}); | ||
@@ -582,21 +582,21 @@ }); | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0].assertions[0])).to.include('result'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0].assertions[0])).to.include('result'); | ||
}); | ||
describe('"@type" field', function() { | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0].assertions[0].result)).to.include('@type'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0].assertions[0].result)).to.include('@type'); | ||
}); | ||
it('should be of type string', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0].result['@type']).to.be.a('string'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0].result['@type']).to.be.a('string'); | ||
}); | ||
it('should not be empty', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0].result['@type'].trim()).to.not.be.equal(''); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0].result['@type'].trim()).to.not.be.equal(''); | ||
}); | ||
it('should be "TestCase"', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0].result['@type'].trim()).to.be.equal('TestResult'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0].result['@type'].trim()).to.be.equal('TestResult'); | ||
}); | ||
@@ -606,16 +606,16 @@ }); | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0].assertions[0].result)).to.include('outcome'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0].assertions[0].result)).to.include('outcome'); | ||
}); | ||
it('should be of type string', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0].result['outcome']).to.be.a('string'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0].result['outcome']).to.be.a('string'); | ||
}); | ||
it('should not be empty', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0].result['outcome'].trim()).to.not.be.equal(''); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0].result['outcome'].trim()).to.not.be.equal(''); | ||
}); | ||
it('should be "earl:passed" or "earl:failed" or "earl:inapplicable"', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(['earl:passed', 'earl:failed', 'earl:inapplicable']).to.include(earl.graph[0].assertions[0].result['outcome'].trim()); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(['earl:passed', 'earl:failed', 'earl:inapplicable']).to.include(earl[0].graph[0].assertions[0].result['outcome'].trim()); | ||
}); | ||
@@ -625,22 +625,22 @@ }); | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0].assertions[0].result)).to.include('source'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0].assertions[0].result)).to.include('source'); | ||
}); | ||
describe('"result" field', function() { | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0].assertions[0].result.source[0])).to.include('result'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0].assertions[0].result.source[0])).to.include('result'); | ||
}); | ||
describe('"pointer" field', function() { | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0].assertions[0].result.source[0].result)).to.include('pointer'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0].assertions[0].result.source[0].result)).to.include('pointer'); | ||
}); | ||
it('should be of type string', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0].result.source[0].result.pointer).to.be.a('string'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0].result.source[0].result.pointer).to.be.a('string'); | ||
}); | ||
it('should not be empty', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0].result.source[0].result.pointer.trim()).to.not.be.equal(''); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0].result.source[0].result.pointer.trim()).to.not.be.equal(''); | ||
}); | ||
@@ -650,16 +650,16 @@ }); | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0].assertions[0].result.source[0].result)).to.include('outcome'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0].assertions[0].result.source[0].result)).to.include('outcome'); | ||
}); | ||
it('should be of type string', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0].result.source[0].result.outcome).to.be.a('string'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0].result.source[0].result.outcome).to.be.a('string'); | ||
}); | ||
it('should not be empty', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0].result.source[0].result.outcome.trim()).to.not.be.equal(''); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0].result.source[0].result.outcome.trim()).to.not.be.equal(''); | ||
}); | ||
it('should be "earl:passed" or "earl:failed" or "earl:inapplicable"', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(['earl:passed', 'earl:failed', 'earl:inapplicable']).to.include(earl.graph[0].assertions[0].result.source[0].result.outcome.trim()); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(['earl:passed', 'earl:failed', 'earl:inapplicable']).to.include(earl[0].graph[0].assertions[0].result.source[0].result.outcome.trim()); | ||
}); | ||
@@ -671,12 +671,12 @@ }); | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0].assertions[0].result)).to.include('description'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0].assertions[0].result)).to.include('description'); | ||
}); | ||
it('should be of type string', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0].result['description']).to.be.a('string'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0].result['description']).to.be.a('string'); | ||
}); | ||
it('should not be empty', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0].result['description'].trim()).to.not.be.equal(''); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0].result['description'].trim()).to.not.be.equal(''); | ||
}); | ||
@@ -686,12 +686,12 @@ }); | ||
it('should exist', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(Object.keys(earl.graph[0].assertions[0].result)).to.include('date'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(Object.keys(earl[0].graph[0].assertions[0].result)).to.include('date'); | ||
}); | ||
it('should be of type string', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0].result['date']).to.be.a('string'); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0].result['date']).to.be.a('string'); | ||
}); | ||
it('should not be empty', async function() { | ||
const earl = await reporter.generateSingleEarlReport(evaluationReport); | ||
expect(earl.graph[0].assertions[0].result['date'].trim()).to.not.be.equal(''); | ||
const earl = await reporter.generateEARLReport([evaluationReport]); | ||
expect(earl[0].graph[0].assertions[0].result['date'].trim()).to.not.be.equal(''); | ||
}); | ||
@@ -698,0 +698,0 @@ }); |
Sorry, the diff of this file is not supported yet
76680
18
1619