Use even more optional chaining in the code-base

This commit is contained in:
Jonas Jenwald 2023-11-02 16:47:33 +01:00
parent f528f6f07b
commit 155a302e74
3 changed files with 4 additions and 4 deletions

View file

@ -460,7 +460,7 @@ function checkEq(task, results, browser, masterMode) {
}
const pageResult = pageResults[page];
let testSnapshot = pageResult.snapshot;
if (testSnapshot && testSnapshot.startsWith("data:image/png;base64,")) {
if (testSnapshot?.startsWith("data:image/png;base64,")) {
testSnapshot = Buffer.from(testSnapshot.substring(22), "base64");
} else {
console.error("Valid snapshot was not found.");
@ -759,7 +759,7 @@ function refTestPostHandler(req, res) {
});
}
var isDone = taskResults.at(-1) && taskResults.at(-1)[lastPageNum - 1];
var isDone = taskResults.at(-1)?.[lastPageNum - 1];
if (isDone) {
checkRefTestResults(browser, id, taskResults);
session.remaining--;