Skip to content

Commit 47c6d28

Browse files
committed
(#320) Update toShow matcher accordingly
1 parent 2568487 commit 47c6d28

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

lib/expect/jest.matcher.function.ts

+16-15
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
import { Point } from "../point.class";
2-
import { Region } from "../region.class";
3-
import { toBeAt } from "./matchers/toBeAt.function";
4-
import { toBeIn } from "./matchers/toBeIn.function";
5-
import { toShow } from "./matchers/toShow.function";
6-
import {Image} from "../image.class";
1+
import {Point} from "../point.class";
2+
import {Region} from "../region.class";
3+
import {toBeAt} from "./matchers/toBeAt.function";
4+
import {toBeIn} from "./matchers/toBeIn.function";
5+
import {toShow} from "./matchers/toShow.function";
6+
import {FirstArgumentType} from "../typings";
7+
import {ScreenClass} from "../screen.class";
78

89
declare global {
9-
namespace jest {
10-
interface Matchers<R> {
11-
toBeAt: (position: Point) => {};
12-
toBeIn: (region: Region) => {};
13-
toShow: (needle: string | Image, confidence?: number) => {};
10+
namespace jest {
11+
interface Matchers<R> {
12+
toBeAt: (position: Point) => {};
13+
toBeIn: (region: Region) => {};
14+
toShow: (needle: FirstArgumentType<typeof ScreenClass.prototype.find>, confidence?: number) => {};
15+
}
1416
}
15-
}
1617
}
1718

1819
export const jestMatchers = {
19-
toBeAt,
20-
toBeIn,
21-
toShow,
20+
toBeAt,
21+
toBeIn,
22+
toShow,
2223
};

lib/expect/matchers/toShow.function.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import {LocationParameters} from "../../locationparameters.class";
22
import {ScreenClass} from "../../screen.class";
3-
import {Image} from "../../image.class";
3+
import {FirstArgumentType} from "../../typings";
44

55
export const toShow = async (
66
received: ScreenClass,
7-
needle: string | Image,
7+
needle: FirstArgumentType<typeof ScreenClass.prototype.find>,
88
confidence?: number,
99
) => {
1010
let locationParams;

0 commit comments

Comments
 (0)