Skip to content
This repository was archived by the owner on Dec 6, 2022. It is now read-only.

Commit 4f2af39

Browse files
committed
Fix tests
1 parent f77b81e commit 4f2af39

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

test/debugProtocolMocks.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export interface IMockChromeConnectionAPI {
1818
Inspector: IMock<Crdp.InspectorApi>;
1919
Network: IMock<Crdp.NetworkApi>;
2020
Page: IMock<Crdp.PageApi>;
21+
Log: IMock<Crdp.LogApi>;
2122

2223
mockEventEmitter: EventEmitter;
2324
}
@@ -79,6 +80,13 @@ function getPageStubs() {
7980
};
8081
}
8182

83+
function getLogStubs() {
84+
return {
85+
enable() { },
86+
on(eventName, handler) { }
87+
};
88+
}
89+
8290
export function getMockChromeConnectionApi(): IMockChromeConnectionAPI {
8391
const mockEventEmitter = new EventEmitter();
8492

@@ -114,14 +122,18 @@ export function getMockChromeConnectionApi(): IMockChromeConnectionAPI {
114122
const mockBrowser = Mock.ofInstance<Crdp.BrowserApi>(<any>getBrowserStubs());
115123
mockBrowser.callBase = true;
116124

125+
const mockLog = Mock.ofInstance<Crdp.LogApi>(<any>getLogStubs());
126+
mockLog.callBase = true;
127+
117128
const chromeConnectionAPI: Crdp.ProtocolApi = <any>{
118129
Browser: mockBrowser.object,
119130
Console: mockConsole.object,
120131
Debugger: mockDebugger.object,
121132
Runtime: mockRuntime.object,
122133
Inspector: mockInspector.object,
123134
Network: mockNetwork.object,
124-
Page: mockPage.object
135+
Page: mockPage.object,
136+
Log: mockLog.object
125137
};
126138

127139
return {
@@ -134,6 +146,7 @@ export function getMockChromeConnectionApi(): IMockChromeConnectionAPI {
134146
Inspector: mockInspector,
135147
Network: mockNetwork,
136148
Page: mockPage,
149+
Log: mockLog,
137150

138151
mockEventEmitter
139152
};

0 commit comments

Comments
 (0)