MCPcopy Create free account
hub / github.com/garris/BackstopJS / modifyJsonpReportHelper

Function modifyJsonpReportHelper

core/util/remote.js:21–34  ·  view source on GitHub ↗

* Helper function to modify the test status of the JSONP report based on the approved file name. * * @param {String} originalJsonpReport - jsonpReport `report(${jsonReport});` * @param {String} approvedFileName - the name of the screenshot that is approved * @return {String} jsonpReport - modifi

(originalJsonpReport, approvedFileName)

Source from the content-addressed store, hash-verified

19 * @return {String} jsonpReport - modified jsonpReport
20 */
21function modifyJsonpReportHelper (originalJsonpReport, approvedFileName) {
22 const report = extractReport(originalJsonpReport);
23 report.tests.forEach(test => {
24 if (test.pair.fileName === approvedFileName) {
25 test.status = 'pass';
26 delete test.pair.diffImage;
27 }
28 return test;
29 });
30
31 const jsonReport = JSON.stringify(report, null, 2);
32 const jsonpReport = `report(${jsonReport});`;
33 return jsonpReport;
34}
35
36/**
37 * Modify the test status of the JSONP report based on the approved file name. JSONP is used

Callers 2

modifyJsonpReportFunction · 0.85
remote_spec.jsFile · 0.85

Calls 1

extractReportFunction · 0.85

Tested by

no test coverage detected