Skip to content

Commit

Permalink
Step 4.23: Tests of PartyRemove
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Kisiela authored and Dotan Simha committed Nov 22, 2016
1 parent 3787cab commit 9e11c5d
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions imports/ui/components/partyRemove/client/partyRemove.tests.js
@@ -0,0 +1,37 @@
import { name as PartyRemove } from '../partyRemove';
import { Parties } from '../../../../api/parties';
import 'angular-mocks';

describe('PartyRemove', () => {
beforeEach(() => {
window.module(PartyRemove);
});

describe('controller', () => {
let controller;
const party = {
_id: 'partyId'
};

beforeEach(() => {
inject(($rootScope, $componentController) => {
controller = $componentController(PartyRemove, {
$scope: $rootScope.$new(true)
}, {
party
});
});
});

describe('remove()', () => {
beforeEach(() => {
spyOn(Parties, 'remove');
controller.remove();
});

it('should remove a party', () => {
expect(Parties.remove).toHaveBeenCalledWith(party._id);
});
});
});
});

0 comments on commit 9e11c5d

Please sign in to comment.