Skip to content

Commit c667e28

Browse files
author
brucou
committed
chore(test) : prepared test architecture
1 parent e29081c commit c667e28

13 files changed

+8078
-10
lines changed

Diff for: TODO.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// TODO : test actions are run in order...
2+
- look at that plan-oriented-testing (recoup with the improvement in the testing generation)
23
- explain testing
34
- explain the resulting architecture
45
- communicate outputs by callback : similar to onClick for instance

Diff for: webpack.config.js renamed to ___webpack.config.js

File renamed without changes.

Diff for: __tests__/app.specs.js

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import React from 'react';
2+
import renderer from 'react-test-renderer';
3+
import sinon from 'sinon';
4+
import {Machine} from '../src'
5+
import {
6+
getByLabelText,
7+
getByText,
8+
getByTestId,
9+
queryByTestId,
10+
// Tip: all queries are also exposed on an object
11+
// called "queries" which you could import here as well
12+
wait,
13+
} from 'dom-testing-library'
14+
// import Enzyme, { mount } from 'enzyme';
15+
// import Adapter from 'enzyme-adapter-react-16';
16+
// Enzyme.configure({ adapter: new Adapter() });
17+
18+
test('Link changes the class when hovered', () => {
19+
// const component = renderer.create(<div>"Hello"</div>);
20+
// let tree = component.toJSON();
21+
// expect(tree).toMatchSnapshot();
22+
const onButtonClick = sinon.spy();
23+
const wrapper = mount((
24+
<div onButtonClick={onButtonClick}>"Hello"</div>
25+
));
26+
wrapper.find('div').simulate('click');
27+
expect(onButtonClick).to.have.property('callCount', 1);
28+
});
29+
30+
// TODO : use Qunit to test in the browser
31+
// qunit index.html to add id for test location (with data-id : module name)
32+
// render the react component in the DOM
33+
// use dom-testing-library to do the input simulation and wait for outputs
34+
// test output vs expected outputs
35+
// consume all input sequence!
36+
// first try set up with a small trivial example
37+
// then with one input sequence by hand
38+
// then automate it for any input sequence
39+

0 commit comments

Comments
 (0)