(req, res, next)
| 352 | |
| 353 | |
| 354 | function runVideoTestBench(req, res, next) { |
| 355 | fs.promises.readFile(sourceFile).then(contents => { |
| 356 | const dom = new JSDOM(contents); |
| 357 | const {window} = dom; |
| 358 | const doc = window.document; |
| 359 | |
| 360 | const {extension} = req.query; |
| 361 | |
| 362 | setOptionalAttrs(req, doc); |
| 363 | |
| 364 | if (extension) { |
| 365 | if (!isValidExtension(extension)) { |
| 366 | res.status(403); |
| 367 | res.end('Invalid extension parameter.'); |
| 368 | return; |
| 369 | } |
| 370 | replaceExtension(doc, extension); |
| 371 | } |
| 372 | |
| 373 | const dropdownContainer = doc.querySelector('.dropdown-container'); |
| 374 | dropdownContainer.appendChild(renderExtensionDropdown(doc), extension); |
| 375 | |
| 376 | const optionalAttrsContainer = |
| 377 | doc.querySelector('.optional-attrs-container'); |
| 378 | optionalAttrsContainer.appendChild(renderOptionalAttrsCheckboxes(doc)); |
| 379 | |
| 380 | appendClientScript(doc); |
| 381 | |
| 382 | return res.end(replaceUrls(getServeMode(), dom.serialize())); |
| 383 | }).catch(() => { |
| 384 | next(); |
| 385 | }); |
| 386 | } |
| 387 | |
| 388 | |
| 389 | module.exports = runVideoTestBench; |
nothing calls this directly
no test coverage detected