Skip to content

Instantly share code, notes, and snippets.

@aaronshaf
Created November 17, 2014 15:58
Show Gist options
  • Select an option

  • Save aaronshaf/5dff8fcaadbde4c971c8 to your computer and use it in GitHub Desktop.

Select an option

Save aaronshaf/5dff8fcaadbde4c971c8 to your computer and use it in GitHub Desktop.
Testing with mocha, a custom fixture utility, ES6 destructuring, and ES7 async/await
describe('as a super administrator', function() {
it('create a session', async function(done) {
var {
user,
password
} = await fixtures(['User'], {
user: { superAdministrator: true }
})
request(app)
.post('/api/sessions')
.set('Content-Type', 'application/json')
.send({
username: user.username,
password: password
})
.expect(200)
.end(done)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment