Skip to content

Commit

Permalink
fix(screenshot-undo): do not fail on revert screenshot with different…
Browse files Browse the repository at this point in the history
… state name
  • Loading branch information
sipayRT committed Oct 2, 2023
1 parent fd771fc commit 5c51487
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/report-builder/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ module.exports = class GuiReportBuilder extends StaticReportBuilder {
}

const previousExpectedPath = _.get(previousImage, 'expectedImg.path', null);
const shouldRemoveReference = _.isNull(previousImage.refImg.size);
const previousImageRefImgSize = _.get(previousImage, 'refImg.size', null);
const shouldRemoveReference = _.isNull(previousImageRefImgSize);
const shouldRevertReference = !shouldRemoveReference;

let updatedImage, removedResult;
Expand Down
7 changes: 2 additions & 5 deletions test/unit/lib/report-builder/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ describe('GuiReportBuilder', () => {
let reportBuilder;

function stubResultData_(result, {resultId, stateName}) {
const res = _.defaultsDeep(result, {
const res = _.defaults(result, {
imageId: 'imageId',
status: UPDATED,
timestamp: 100500,
Expand Down Expand Up @@ -475,10 +475,7 @@ describe('GuiReportBuilder', () => {
const resultId = 'result-id';
const stateName = 's-name';
const formattedResult = mkFormattedResultStub_({id: resultId, stateName});
const previousImage = {
expectedImg: {path: 'previous-expected-path'},
refImg: {path: 'previous-reference-path', size: null}
};
const previousImage = null;
const updatedImage = {
id: 'updated-img-id',
parentId: 'parent-id'
Expand Down

0 comments on commit 5c51487

Please sign in to comment.