Skip to content

Instantly share code, notes, and snippets.

@eyaleizenberg
Last active June 12, 2019 05:18
Show Gist options
  • Save eyaleizenberg/f798d5dfdcc10f42b9d027a68f174c07 to your computer and use it in GitHub Desktop.
Save eyaleizenberg/f798d5dfdcc10f42b9d027a68f174c07 to your computer and use it in GitHub Desktop.
import { HelloPerson, Props } from './hello_person.component';
import { shallow } from 'enzyme';
export class HelloPersonDriver {
private wrapper;
private props: Props = {
name: 'some name'
}
given = {
name: (value: string): this => {
this.props.name = value;
return this;
}
};
when = {
rendered: (): this => {
this.wrapper = shallow<HelloPerson>(<HelloPerson {...this.props} />);
return this;
}
};
get = {
renderedName: (): string => this.wrapper.find('#name').text()
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment