Jamstash/app/queue/queue_test.js
Hyzual e51961c167 Starts rewriting the player service.
The API is simplified: we can play a song, restart the currently playing song, load a song (that'll be used only by local storage), play the next track or the previous track.

As a result, I changed all the calls to playSong(false, song) which are now just play(song)
2015-01-17 19:13:40 +01:00

33 lines
938 B
JavaScript

describe("Queue controller", function() {
'use strict';
var player, $rootScope, scope, globals;
beforeEach(function() {
module('jamstash.queue.controller');
inject(function ($controller, _$rootScope_, _globals_, _player_) {
$rootScope = _$rootScope_;
scope = $rootScope.$new();
globals = _globals_;
player = _player_;
// Mock the functions of the services
spyOn(player, "play").and.stub();
$controller('QueueController', {
$rootScope: $rootScope,
$scope: scope,
globals: globals,
player: player
});
});
});
it("When I call playSong, it calls play in the player service", function() {
var fakeSong = {"id": 3174};
scope.playSong(fakeSong);
expect(player.play).toHaveBeenCalledWith(fakeSong);
});
});