Skip to content

Instantly share code, notes, and snippets.

@mutaimwiti
Last active November 27, 2019 08:08
Show Gist options
  • Save mutaimwiti/ff0d41a7e5d2eae0a774abe64197f2a3 to your computer and use it in GitHub Desktop.
Save mutaimwiti/ff0d41a7e5d2eae0a774abe64197f2a3 to your computer and use it in GitHub Desktop.
Using wrapper es6
// test/article.spec.js
import app from './testUtils/app';
describe('Articles', () => {
describe('GET', () => {
it('should not allow unauthenticated users to list all articles', async () => {
const res = await app.get('/articles');
expect(res.status).toBe(401);
});
it('should allow authenticated users to list all articles', async () => {
await app.loginRandom();
const { body } = await app.get('/articles');
expect(body.articles).toEqual('All articles');
app.logout();
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment