mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Cleanup integration and unit tests (#3531)
- Make mockWindow a function and call it when needed - Change timeouts so that better error messages happen more often in integration tests Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
b546f1df72
commit
4fc340d0c6
7 files changed
+51
-57
No files matched your search
+13
-10
@@ -19,14 +19,17 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
Object.defineProperty(window, "requestIdleCallback", {
|
||||
writable: true,
|
||||
value: jest.fn().mockImplementation(callback => callback()),
|
||||
});
|
||||
/**
|
||||
* Mock the global window variable
|
||||
*/
|
||||
export function mockWindow() {
|
||||
Object.defineProperty(window, "requestIdleCallback", {
|
||||
writable: true,
|
||||
value: jest.fn().mockImplementation(callback => callback()),
|
||||
});
|
||||
|
||||
Object.defineProperty(window, "cancelIdleCallback", {
|
||||
writable: true,
|
||||
value: jest.fn(),
|
||||
});
|
||||
|
||||
export default {};
|
||||
Object.defineProperty(window, "cancelIdleCallback", {
|
||||
writable: true,
|
||||
value: jest.fn(),
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user