Skip to content

Instantly share code, notes, and snippets.

@bmdalex
Created January 24, 2021 21:31
Show Gist options
  • Save bmdalex/9d33b9acea01b47b19a9e4daa7a4c139 to your computer and use it in GitHub Desktop.
Save bmdalex/9d33b9acea01b47b19a9e4daa7a4c139 to your computer and use it in GitHub Desktop.
DO split tests using the frameworks' capabilities
describe('when the user submits a valid form', () => {
beforeEach(() => {
  /*
  * preconditions
  */
  })
it('should enable the submit button', () => {
expect(getFormSubmitButton(wrapper).attributes('disabled')).toBe(undefined)
  })
it('should register the user by calling external API', () => {
  expect($auth.registerUser).toHaveBeenCalledWith({ email: validEmail })
  })
it('should emit the "register-update" event', () => {
  expect(wrapper.emitted()['register-update'][0]).toBe(registerUserResponse)
  })
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment