-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: make invalid png error similar to assert view errors (#1028)
- Loading branch information
1 parent
dd57550
commit c91e897
Showing
7 changed files
with
50 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
src/browser/commands/assert-view/errors/invalid-png-error.js
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
src/browser/commands/assert-view/errors/invalid-ref-image-error.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { BaseStateError } from "./base-state-error"; | ||
import { ImageInfo, RefImageInfo } from "../../../../types"; | ||
|
||
type InvalidRefImageErrorConstructor<T> = new (stateName: string, currImg: ImageInfo, refImg: RefImageInfo) => T; | ||
|
||
export class InvalidRefImageError extends BaseStateError { | ||
constructor(stateName: string, currImg: ImageInfo, refImg: RefImageInfo) { | ||
super(stateName, currImg, refImg); | ||
|
||
this.message = `reference image at ${refImg.path} is not a valid png`; | ||
} | ||
|
||
static fromObject<T extends InvalidRefImageError>( | ||
this: InvalidRefImageErrorConstructor<T>, | ||
data: InvalidRefImageError, | ||
): T { | ||
return new this(data.stateName, data.currImg, data.refImg); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters