Skip to content

Commit

Permalink
(test/refactor): rewrite more to be closer to BDD-style
Browse files Browse the repository at this point in the history
  • Loading branch information
agilgur5 committed Jul 30, 2019
1 parent bbf06a0 commit 0e7ace7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ test('mounts canvas and instance properly', () => {
expect(instance.isEmpty()).toBe(true)
})

describe('props are set and updated correctly', () => {
test('default props should match', () => {
describe('setting and updating props', () => {
it('should set default props', () => {
const instance = mount(<SignatureCanvas />).instance()
expect(instance.props).toStrictEqual(SignatureCanvas.defaultProps)
})

test('mounted initial props and options should match', () => {
it('should set initial mount props and SigPad options', () => {
const instance = mount(<SignatureCanvas {...propsF.all} />).instance()
const sigPad = instance.getSignaturePad()

expect(instance.props).toMatchObject(propsF.all)
expect(sigPad).toMatchObject(propsF.sigPadOptions)
})

test('updated props and options should match', () => {
it('should update props and SigPad options', () => {
const wrapper = mount(<SignatureCanvas />)
const instance = wrapper.instance()
const sigPad = instance.getSignaturePad()
Expand Down Expand Up @@ -117,7 +117,7 @@ describe('SigCanvas wrapper methods return equivalent to SigPad', () => {
})

// comes after props and wrapper methods as it uses both
describe('get methods return correct canvases', () => {
describe('get methods', () => {
const instance = mount(
<SignatureCanvas canvasProps={dotF.canvasProps} />
).instance()
Expand Down

0 comments on commit 0e7ace7

Please sign in to comment.