Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
describe('GET potatoes', function() {
it('returns JSON with only authenticated robot\'s potatoes', function*() {
const glados = yield factory.create('robot');
const gladosPotatoes = [
yield factory.create('potato', { ownerId: glados.id });
yield factory.create('potato', { ownerId: glados.id });
];
const wheatley = yield factory.create('robot');
const wheatleyPotato =
yield factory.create('potato', { ownerId: wheatley.id });
const response = yield request.auth(glados).get('/potatoes');
const potatoesResponse = response.body.potatoes;
const returnedIds = _.pluck(potatoesResponse, 'id');
expect(returnedIds).to.include(_.pluck(gladosPotatoes, 'id'));
expect(returnedIds).not.to.include(wheatleyPotato.id);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.