We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
mockResolvedValue
1 parent fd2b91d commit 65e652bCopy full SHA for 65e652b
extensions/ql-vscode/test/vscode-tests/utils/mocking.helpers.ts
@@ -30,6 +30,13 @@ export function mockedObject<T extends object>(
30
if (dynamicProperties && prop in dynamicProperties) {
31
return (dynamicProperties as any)[prop]();
32
}
33
+
34
+ // The `then` method is accessed by `Promise.resolve` to check if the object is a thenable.
35
+ // We don't want to throw an error when this happens.
36
+ if (prop === "then") {
37
+ return undefined;
38
+ }
39
40
throw new Error(`Method ${String(prop)} not mocked`);
41
},
42
});
0 commit comments