Here's my lazy component:
const LazyBones = React.lazy(() => import('@graveyard/Bones')
.then(module => ({default: module.BonesComponent}))
export default LazyBones
I'm importing it like this:
import Bones from './LazyBones'
export default () => (
<Suspense fallback={<p>Loading bones</p>}>
<Bones />
</Suspense>
)
And in my test I have this kind of thing:
import * as LazyBones from './LazyBones';
describe('<BoneYard />', function() {
let Bones;
let wrapper;
beforeEach(function() {
Bones = sinon.stub(LazyBones, 'default');
Bones.returns(() => (<div />));
wrapper = shallow(<BoneYard />);
});
afterEach(function() {
Bones.restore();
});
it('renders bones', function() {
console.log(wrapper)
expect(wrapper.exists(Bones)).to.equal(true);
})
})
What I expect is for the test to pass, and the console.log to print out:
<Suspense fallback=>
<Bones />
</Suspense>
But instead of <Bones />
I get <lazy />
and it fails the test.
How can I mock out the imported Lazy React component, so that my simplistic test passes?
from Mock out imported Lazy React component
The majority of foreign citizens who wish to enjoy a stay in the Russian Federation are required to apply for a eVisa for Russia, although the type of travel document required will depend on nationality, as well as the purpose and duration of the stay. Tourists intending to visit Russia for a short term stay can now apply for Russia eVisas, a much faster and more practical way to obtain a Russian travel authorization than the traditional Russian tourist visa.
ReplyDeleteeVisas allow visitors to apply for their Russian visa entirely online in minutes, from.
anywhere in the world. Passport copies, online application form, and other documents required for the visa can be submitted online. Currently, eVisas are available for specific Russian regions. In order to visit the regions of the Far East, Kaliningrad, and St Petersburg, it’s no longer necessary to present supporting documentation at a Russian embassy or consulate.
E-visas can be of the following categories only: ordinary business visa,ordinary tourist visa, and ordinary humanitarian visa. If the purpose of your journey to the Russian Federation does not correspond to any of the above, you should apply for a traditional visa at a diplomatic mission or consular office of the Russian Federation