Skip to content

Commit

Permalink
Step 12.22: Tests of PartiesList
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Kisiela authored and DAB0mB committed Dec 14, 2016
1 parent c431689 commit 96994d3
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions imports/ui/components/partiesList/client/partiesList.tests.js
@@ -0,0 +1,50 @@
import { name as PartiesList } from '../partiesList';
import 'angular-mocks';

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

describe('controller', () => {
let controller;

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

it('should have perPage that equals 3 by default', () => {
expect(controller.perPage).toEqual(3);
});

it('should have page that equals 1 by default', () => {
expect(controller.page).toEqual(1);
});

it('should sort by name - ASC', () => {
expect(controller.sort).toEqual({
name: 1
});
});

it('should be able to change sorting', () => {
controller.sortChanged({
name: -1
});

expect(controller.sort).toEqual({
name: -1
});
});

it('should be able to change page', () => {
controller.pageChanged(2);

expect(controller.page).toEqual(2);
});
});
});

0 comments on commit 96994d3

Please sign in to comment.