Skip to content

Instantly share code, notes, and snippets.

@bmdalex
Last active January 24, 2021 21:29
Show Gist options
  • Save bmdalex/1183a93ae93457742e9d50696a184514 to your computer and use it in GitHub Desktop.
Save bmdalex/1183a93ae93457742e9d50696a184514 to your computer and use it in GitHub Desktop.
DO group tests by behaviours (BDT) and preconditions
describe('when the user submits a valid form', () => {
beforeEach(() => { ... })
it('should enable the submit button', () => { ... })
it('should register the user by calling external API', () => { ... })
})
describe('when the user submits an invalid form', () => {
beforeEach(() => { ... })
it('should disable the submit button', () => { ... })
describe('by using an invalid email', () => {
beforeEach(() => { ... })
it('should log the appropriate error', () => { ... })
it('should not register the user', () => { ... })
})
describe('by not accepting terms and conditions', () => {
beforeEach(() => { ...})
it('should log the appropriate error', () => { ... })
it('should not register the user', () => { ... })
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment