1 | function createStagesMock() {
|
2 | var stages = [
|
3 | { id: "practice", name: "Oefenrondes", rounds: 2, $rounds: [1, 2] },
|
4 | { id: "qualifying", name: "Voorrondes", rounds: 3, $rounds: [1, 2, 3] },
|
5 | { id: "quarter", name: "Kwart finales", rounds: 0, $rounds: [] },
|
6 | { id: "semi", name: "Halve finales", rounds: 0, $rounds: [] },
|
7 | { id: "final", name: "Finale", rounds: 1, $rounds: [1] },
|
8 | ];
|
9 | return {
|
10 | stages: stages,
|
11 | allStages: stages,
|
12 | init: jasmine.createSpy('save').and.returnValue(Q.when()),
|
13 | get: function(id) {
|
14 | var i;
|
15 | for (i = 0; i < stages.length; i++) {
|
16 | if (stages[i].id === id) {
|
17 | return stages[i];
|
18 | }
|
19 | }
|
20 | return undefined;
|
21 | },
|
22 | save: jasmine.createSpy('save'),
|
23 | remove: jasmine.createSpy('remove'),
|
24 | moveStage: jasmine.createSpy('moveStage'),
|
25 | add: jasmine.createSpy('add'),
|
26 | clear: jasmine.createSpy('clear')
|
27 | };
|
28 | }
|