File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ import { Window } from "./window.class" ;
2+ import { NativeAdapter } from "./adapter/native.adapter.class" ;
3+
4+ jest . mock ( "./adapter/native.adapter.class" ) ;
5+
6+ describe ( "Window class" , ( ) => {
7+ it ( "should retrieve the window region via its native adapter" , async ( ) => {
8+ // GIVEN
9+ const nativeAdapterMock = new NativeAdapter ( ) ;
10+ const mockWindowHandle = 123 ;
11+ const SUT = new Window ( nativeAdapterMock , mockWindowHandle ) ;
12+
13+ // WHEN
14+ await SUT . region
15+
16+ // THEN
17+ expect ( nativeAdapterMock . getWindowRegion ) . toBeCalledTimes ( 1 ) ;
18+ expect ( nativeAdapterMock . getWindowRegion ) . toBeCalledWith ( mockWindowHandle ) ;
19+ } ) ;
20+
21+ it ( "should retrieve the window title via its native adapter" , async ( ) => {
22+ // GIVEN
23+ const nativeAdapterMock = new NativeAdapter ( ) ;
24+ const mockWindowHandle = 123 ;
25+ const SUT = new Window ( nativeAdapterMock , mockWindowHandle ) ;
26+
27+ // WHEN
28+ await SUT . title
29+
30+ // THEN
31+ expect ( nativeAdapterMock . getWindowTitle ) . toBeCalledTimes ( 1 ) ;
32+ expect ( nativeAdapterMock . getWindowTitle ) . toBeCalledWith ( mockWindowHandle ) ;
33+ } ) ;
34+ } ) ;
You can’t perform that action at this time.
0 commit comments