Fixes the queue test
This commit is contained in:
parent
e5846e30f9
commit
91b112cb0a
2 changed files with 15 additions and 12 deletions
|
@ -1,7 +1,7 @@
|
|||
angular.module('jamstash.queue.ctrl', [])
|
||||
angular.module('jamstash.queue.ctrl', ['jamstash.player.service'])
|
||||
|
||||
.controller('QueueCtrl', ['$scope', '$rootScope', '$routeParams', '$location', 'utils', 'globals', 'player',
|
||||
function QueueCtrl($scope, $rootScope, $routeParams, $location, utils, globals, player) {
|
||||
.controller('QueueCtrl', ['$scope', '$rootScope', 'globals', 'player',
|
||||
function QueueCtrl($scope, $rootScope, globals, player) {
|
||||
'use strict';
|
||||
$scope.settings = globals.settings;
|
||||
$scope.song = $rootScope.queue;
|
||||
|
|
|
@ -1,24 +1,28 @@
|
|||
describe("Queue controller", function() {
|
||||
'use strict';
|
||||
|
||||
var player, scope;
|
||||
var player, $rootScope, scope, globals;
|
||||
|
||||
beforeEach(function() {
|
||||
module('jamstash.queue.ctrl');
|
||||
|
||||
inject(function ($controller, $rootScope, _player_) {
|
||||
inject(function ($controller, _$rootScope_, _globals_, _player_) {
|
||||
$rootScope = _$rootScope_;
|
||||
scope = $rootScope.$new();
|
||||
globals = _globals_;
|
||||
player = _player_;
|
||||
|
||||
// Mock the functions of the services
|
||||
spyOn(player, "playSong").and.stub();
|
||||
|
||||
$controller('PlayerCtrl', {
|
||||
$controller('QueueCtrl', {
|
||||
$rootScope: $rootScope,
|
||||
$scope: scope,
|
||||
globals: globals,
|
||||
player: player
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
it("When I call playSong, it calls playSong in the player service", function() {
|
||||
var fakeSong = {"id": 3174};
|
||||
|
||||
|
@ -26,5 +30,4 @@ describe("Queue controller", function() {
|
|||
|
||||
expect(player.playSong).toHaveBeenCalledWith(true, fakeSong);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue