Skip to content

Instantly share code, notes, and snippets.

7 | const wrap = mount(
8 | <Foo />
> 9 | ).;
| ^
Chrome 71.0.3578 (Mac OS X 10.14.0) ERROR
{
"message": "Uncaught Error: Module build failed (from ./node_modules/babel-loader/lib/index.js):\nSyntaxError: Unexpected token (9:10)\n\n\u001b[0m \u001b[90m 7 | \u001b[39m \u001b[36mconst\u001b[39m wrap \u001b[33m=\u001b[39m mount(\n \u001b[90m 8 | \u001b[39m \u001b[33m<\u001b[39m\u001b[33mFoo\u001b[39m \u001b[33m/\u001b[39m\u001b[33m>\u001b[39m\n\u001b[31m\u001b[1m>\u001b[22m\u001b[39m\u001b[90m 9 | \u001b[39m )\u001b[33m.\u001b[39m\u001b[33m;\u001b[39m\n \u001b[90m | \u001b[39m \u001b[31m\u001b[1m^\u001b[22m\u001b[39m\n \u001b[90m 10 | \u001b[39m \u001b[90m// console.log(wrap.find('.someCustomClass').hostNodes().debug());\u001b[39m\n \u001b[90m 11 | \u001b[39m\n \u001b[90m 12 | \u001b[39m expect(wrap\u001b[33m.\u001b[39mfind(\u001b[32m'.someCustomClass'\u001b[39m)\u001b[33m.\u001b[39mhostNodes())\u001b[33m.\u001b[39mto\u001b[33m.\u001b[39mhave\u001b[33m.\u001b[39mlength(\u001b[35m1\u001b[39m)\u001b[33m;
<div className="someCustomClass">
<h1>
Baz is rendered
</h1>
</div>
<Bar className="someCustomClass">
<div>
<div className="barClass">
<Baz className="someCustomClass">
<div>
<div className="someCustomClass">
<h1>
Baz is rendered
</h1>
</div>
<Bar className="someCustomClass">
<div>
<div className="barClass">
<Baz className="someCustomClass">
<div>
<div className="someCustomClass">
<h1>
Baz is rendered
</h1>
</div>
describe.only('Something about the tests here', function () {
it('tests one thing', function () {
});
});
describe('Something about the tests here', function () {
it('tests one thing', function () {
});
});
<!-- mount() -->
<Foo>
<div>
<div className="fooClass">
<Bar>
<div>
<div className="barClass">
Something here
</div>
</div>
<!-- shallow() -->
<div>
<div className="fooClass">
<Bar />
</div>
</div>
@ahuggins
ahuggins / EditDatasource.spec.js
Created January 25, 2019 17:03
Final Test with instance()
import React from 'react';
import { render, mount, shallow } from 'enzyme';
import EditDatasource from './EditDatasource';
import { MemoryRouter } from 'react-router-dom';
describe('tests for EditDatasource', function () {
it.only('changes the datasource.type when a select button is clicked', function () {
const wrap = mount(
<MemoryRouter>
<EditDatasource