Jest Mock Any Property on Window Utility - with automatic cleanup.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(modules) { | |
function require(id) { | |
const [fn, mapping] = modules[id]; | |
function localRequire(name) { | |
return require(mapping[name]); | |
} | |
const module = { exports : {} }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { render } from 'react-dom'; | |
import Hello from './Hello'; | |
const styles = { | |
fontFamily: 'sans-serif', | |
textAlign: 'center', | |
}; | |
const App = () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as actionTypes from './action-types.js'; | |
class ActionTypeMatching extends AsymmetricMatcher { | |
constructor(expected){ | |
this.$$typeof = Symbol.for('jest.asymmetricMatcher'); | |
this.expected = expected; | |
} | |
asymmetricMatch(other) { |