diff --git a/app/common/model-service.js b/app/common/model-service.js
index 1360859..78afc09 100644
--- a/app/common/model-service.js
+++ b/app/common/model-service.js
@@ -138,4 +138,13 @@ angular.module('jamstash.model', ['jamstash.utils'])
url = globals.BaseURL() + '/stream.view?' + globals.BaseParams() + '&id=' + song.streamId + '&salt=' + salt;
return new model.Song(song.streamId, song.parent, track, title, artist, song.artistId, album, song.albumId, coverartthumb, coverartfull, song.duration, song.userRating, starred, suffix, specs, url, 0, description);
};
+
+ this.mapPodcasts = function (episodes) {
+ var mappedEpisodes = [];
+ var mapEpisode = this.mapPodcast;
+ angular.forEach(episodes, function (episode) {
+ mappedEpisodes.push(mapEpisode(episode));
+ });
+ return mappedEpisodes;
+ };
}]);
diff --git a/app/common/model-service_test.js b/app/common/model-service_test.js
index 26c8eb0..c861ed0 100644
--- a/app/common/model-service_test.js
+++ b/app/common/model-service_test.js
@@ -20,11 +20,11 @@ describe("model service", function() {
expect(model.displayName).toBe("Know Your Enemy - Ghost in the Shell - Stand Alone Complex OST 3 - Yoko Kanno");
});
- it("Given multiple songs, when I map them, it calls mapSong for each song", function() {
+ it("Given multiple songs, when I map them, then mapSong is called for each song", function() {
var songs = [
- {id: 2912},
- {id: 1450},
- {id: 6663}
+ { id: 2912 },
+ { id: 1450 },
+ { id: 6663 }
];
spyOn(map, 'mapSong').and.callFake(function (song) { return song; });
@@ -35,4 +35,20 @@ describe("model service", function() {
expect(map.mapSong).toHaveBeenCalledWith({id: 6663});
expect(result).toEqual(songs);
});
+
+ it("Given multiple podcast episodes, when I map them, then mapPodcast is called for each episode", function() {
+ var episodes = [
+ { id: 63 },
+ { id: 24 },
+ { id: 80 }
+ ];
+ spyOn(map, 'mapPodcast').and.callFake(function (episode) { return episode; });
+
+ var result = map.mapPodcasts(episodes);
+ expect(map.mapPodcast.calls.count()).toEqual(3);
+ expect(map.mapPodcast).toHaveBeenCalledWith({ id: 63 });
+ expect(map.mapPodcast).toHaveBeenCalledWith({ id: 24 });
+ expect(map.mapPodcast).toHaveBeenCalledWith({ id: 80 });
+ expect(result).toEqual(episodes);
+ });
});
diff --git a/app/subsonic/subsonic-service.js b/app/subsonic/subsonic-service.js
index 2a2b940..ebd5802 100644
--- a/app/subsonic/subsonic-service.js
+++ b/app/subsonic/subsonic-service.js
@@ -427,7 +427,7 @@ angular.module('jamstash.subsonic.service', ['jamstash.settings', 'jamstash.util
id: id
}
}).then(function (subsonicResponse) {
- if(subsonicResponse.playlist.entry !== undefined && subsonicResponse.playlist.entry.length > 0) {
+ if (subsonicResponse.playlist.entry !== undefined && subsonicResponse.playlist.entry.length > 0) {
return map.mapSongs(subsonicResponse.playlist.entry);
} else {
return $q.reject(exception);
@@ -507,7 +507,11 @@ angular.module('jamstash.subsonic.service', ['jamstash.settings', 'jamstash.util
getPodcasts: function () {
var exception = {reason: 'No podcast found on the Subsonic server.'};
- var promise = this.subsonicRequest('getPodcasts.view')
+ var promise = this.subsonicRequest('getPodcasts.view', {
+ params: {
+ includeEpisodes: false
+ }
+ })
.then(function (subsonicResponse) {
if (subsonicResponse.podcasts !== undefined && subsonicResponse.podcasts.channel !== undefined && subsonicResponse.podcasts.channel.length > 0) {
return subsonicResponse.podcasts.channel;
@@ -518,62 +522,31 @@ angular.module('jamstash.subsonic.service', ['jamstash.settings', 'jamstash.util
return promise;
},
- getPodcast: function (id, action) {
- var deferred = $q.defer();
- content.selectedPodcast = id;
- $.ajax({
- url: globals.BaseURL() + '/getPodcasts.view?' + globals.BaseParams(),
- method: 'GET',
- dataType: globals.settings.Protocol,
- timeout: globals.settings.Timeout,
- success: function (data) {
- if (data["subsonic-response"].podcasts.channel !== undefined) {
- var podcasts = [];
- if (data["subsonic-response"].podcasts.channel.length > 0) {
- podcasts = data["subsonic-response"].podcasts.channel;
- } else {
- podcasts[0] = data["subsonic-response"].podcasts.channel;
- }
- var items = [];
- $.each(podcasts, function (i, item) {
- if (item.id == id) {
- items = item.episode;
- }
+ getPodcast: function (id) {
+ var exception = {reason: 'This podcast was not found on the Subsonic server.'};
+ var promise = this.subsonicRequest('getPodcasts.view', {
+ params: {
+ id: id,
+ includeEpisodes: true
+ }
+ }).then(function (subsonicResponse) {
+ var episodes = [];
+ if (subsonicResponse.podcasts.channel !== undefined && subsonicResponse.podcasts.channel.length > 0) {
+ var channel = subsonicResponse.podcasts.channel[0];
+ if (channel !== null && channel.id === id) {
+ episodes = _(channel.episode).filter(function (episode) {
+ return episode.status === "completed";
});
-
- if (typeof items != 'undefined') {
- if (action == 'add') {
- angular.forEach(items, function (item, key) {
- if (item.status != "skipped") {
- player.queue.push(map.mapPodcast(item));
- }
- });
- notifications.updateMessage(items.length + ' Song(s) Added to Queue', true);
- } else if (action == 'play') {
- player.queue = [];
- angular.forEach(items, function (item, key) {
- if (item.status != "skipped") {
- player.queue.push(map.mapPodcast(item));
- }
- });
- var next = player.queue[0];
- player.play(next);
- notifications.updateMessage(items.length + ' Song(s) Added to Queue', true);
- } else {
- content.album = [];
- content.song = [];
- angular.forEach(items, function (item, key) {
- if (item.status != "skipped") {
- content.song.push(map.mapPodcast(item));
- }
- });
- }
+ if(episodes.length > 0) {
+ return map.mapPodcasts(episodes);
+ } else {
+ return $q.reject({reason: 'No downloaded episode found for this podcast. Please check the podcast settings.'});
}
}
- deferred.resolve(content);
}
+ return $q.reject(exception);
});
- return deferred.promise;
+ return promise;
},
scrobble: function (song) {
diff --git a/app/subsonic/subsonic-service_test.js b/app/subsonic/subsonic-service_test.js
index 2fcdbca..36ea61e 100644
--- a/app/subsonic/subsonic-service_test.js
+++ b/app/subsonic/subsonic-service_test.js
@@ -28,6 +28,9 @@ describe("Subsonic service -", function() {
$delegate.mapSong = function (argument) {
return argument;
};
+ $delegate.mapPodcast = function (argument) {
+ return argument;
+ };
return $delegate;
});
// Mock utils.getValue
@@ -455,6 +458,7 @@ describe("Subsonic service -", function() {
url = 'http://demo.subsonic.com/rest/getPlaylist.view?'+
'c=Jamstash&callback=JSON_CALLBACK&f=jsonp&p=enc:cGFzc3dvcmQ%3D&u=Hyzual&v=1.10.2';
});
+
it("Given a playlist with 2 songs in it, when I get it, it returns the 2 songs of the playlist", function() {
url = 'http://demo.subsonic.com/rest/getPlaylist.view?'+
'c=Jamstash&callback=JSON_CALLBACK&f=jsonp'+'&id=9123'+'&p=enc:cGFzc3dvcmQ%3D&u=Hyzual&v=1.10.2';
@@ -528,11 +532,12 @@ describe("Subsonic service -", function() {
});
describe("When I load the podcasts,", function() {
- var url;
+ var url;
beforeEach(function() {
- url = url = 'http://demo.subsonic.com/rest/getPodcasts.view?'+
- 'c=Jamstash&callback=JSON_CALLBACK&f=jsonp&p=enc:cGFzc3dvcmQ%3D&u=Hyzual&v=1.10.2';
+ url = 'http://demo.subsonic.com/rest/getPodcasts.view?'+
+ 'c=Jamstash&callback=JSON_CALLBACK&f=jsonp'+'&includeEpisodes=false'+'&p=enc:cGFzc3dvcmQ%3D&u=Hyzual&v=1.10.2';
});
+
it("given that there were podcasts in the library, then a promise will be resolved with an array of podcasts", function() {
response["subsonic-response"].podcasts = {
channel: [
@@ -553,7 +558,7 @@ describe("Subsonic service -", function() {
]);
});
- it("given that there weren't any podcast in the library, then a rejected promise with an error message will be returned", function() {
+ it("given that there weren't any podcast in the library, then a promise will be rejected with an error message", function() {
response["subsonic-response"].podcasts = {};
mockBackend.expectJSONP(url).respond(JSON.stringify(response));
@@ -563,4 +568,84 @@ describe("Subsonic service -", function() {
expect(promise).toBeRejectedWith({reason: 'No podcast found on the Subsonic server.'});
});
});
+
+ describe("When I load a podcast,", function() {
+ var url;
+ beforeEach(function() {
+ url = 'http://demo.subsonic.com/rest/getPodcasts.view?'+
+ 'c=Jamstash&callback=JSON_CALLBACK&f=jsonp'+'&id=2695&includeEpisodes=true'+'&p=enc:cGFzc3dvcmQ%3D&u=Hyzual&v=1.10.2';
+ });
+
+ it("given a podcast id, then a promise will be resolved with an array of songs from all the non-skipped episodes of that podcast", function() {
+ response["subsonic-response"].podcasts = {
+ channel: [
+ {
+ id: 2695,
+ episode: [
+ {
+ id: 691,
+ status: "completed"
+ }, {
+ id: 771,
+ status: "skipped"
+ }, {
+ id: 227,
+ status: "completed"
+ }
+ ]
+ }
+ ]
+ };
+ mockBackend.expectJSONP(url).respond(JSON.stringify(response));
+
+ var promise = subsonic.getPodcast(2695);
+ mockBackend.flush();
+
+ expect(promise).toBeResolvedWith([
+ {
+ id: 691,
+ status: "completed"
+ }, {
+ id: 227,
+ status: "completed"
+ }
+ ]);
+ });
+
+ it("given that the podcast I wanted to get didn't exist in the library, when I try to get it, then a promise will be rejected with an error message", function() {
+ response["subsonic-response"].podcasts = {};
+ mockBackend.expectJSONP(url).respond(JSON.stringify(response));
+
+ var promise = subsonic.getPodcast(2695);
+ mockBackend.flush();
+
+ expect(promise).toBeRejectedWith({reason: 'This podcast was not found on the Subsonic server.'});
+ });
+
+ it("given that the podcast I wanted to get was empty (0 non-skipped episode in it), when I get it, then a promise will be rejected with an error message", function() {
+ response["subsonic-response"].podcasts = {
+ channel: [
+ {
+ id: 2695,
+ episode: [
+ {
+ id: 678,
+ status: "skipped"
+ },
+ {
+ id: 972,
+ status: "skipped"
+ }
+ ]
+ }
+ ]
+ };
+ mockBackend.expectJSONP(url).respond(JSON.stringify(response));
+
+ var promise = subsonic.getPodcast(2695);
+ mockBackend.flush();
+
+ expect(promise).toBeRejectedWith({reason: 'No downloaded episode found for this podcast. Please check the podcast settings.'});
+ });
+ });
});
diff --git a/app/subsonic/subsonic.html b/app/subsonic/subsonic.html
index 03cb6f5..e803238 100644
--- a/app/subsonic/subsonic.html
+++ b/app/subsonic/subsonic.html
@@ -181,9 +181,10 @@
- Podcasts
- -
+
-
{{o.title}}
diff --git a/app/subsonic/subsonic.js b/app/subsonic/subsonic.js
index d73570f..e079dcc 100644
--- a/app/subsonic/subsonic.js
+++ b/app/subsonic/subsonic.js
@@ -315,15 +315,20 @@ angular.module('jamstash.subsonic.controller', ['jamstash.subsonic.service', 'ja
var promise = subsonic.getRandomStarredSongs();
$scope.requestSongs(promise, action);
- $scope.selectedPlaylist = null;
+ $scope.album = [];
+ $scope.BreadCrumbs = null;
+ $scope.selectedAutoAlbum = null;
+ $scope.selectedArtist = null;
+ $scope.selectedAlbum = null;
$scope.selectedAutoPlaylist = 'starred';
+ $scope.selectedPlaylist = null;
+ $scope.selectedPodcast = null;
};
$scope.getRandomSongs = function (action, genre, folder) {
var promise = subsonic.getRandomSongs(genre, folder);
$scope.requestSongs(promise, action);
- $scope.selectedPlaylist = null;
if (!isNaN(folder)) {
$scope.selectedAutoPlaylist = folder;
} else if (genre !== undefined && genre !== '' && genre !== 'Random') {
@@ -331,6 +336,13 @@ angular.module('jamstash.subsonic.controller', ['jamstash.subsonic.service', 'ja
} else {
$scope.selectedAutoPlaylist = 'random';
}
+ $scope.album = [];
+ $scope.BreadCrumbs = null;
+ $scope.selectedAutoAlbum = null;
+ $scope.selectedArtist = null;
+ $scope.selectedAlbum = null;
+ $scope.selectedPlaylist = null;
+ $scope.selectedPodcast = null;
};
$scope.getStarred = function (action, type) {
@@ -415,8 +427,15 @@ angular.module('jamstash.subsonic.controller', ['jamstash.subsonic.service', 'ja
notifications.updateMessage(songs.length + ' Song(s) in Playlist', true);
}
});
- $scope.selectedPlaylist = id;
+ $scope.song = [];
+ $scope.album = [];
+ $scope.BreadCrumbs = null;
+ $scope.selectedAutoAlbum = null;
+ $scope.selectedArtist = null;
+ $scope.selectedAlbum = null;
$scope.selectedAutoPlaylist = null;
+ $scope.selectedPlaylist = id;
+ $scope.selectedPodcast = null;
};
$scope.newPlaylist = function () {
@@ -526,13 +545,21 @@ angular.module('jamstash.subsonic.controller', ['jamstash.subsonic.service', 'ja
});
};
- $scope.getPodcast = function (id, action) {
- subsonic.getPodcast(id, action).then(function (data) {
- $scope.album = data.album;
- $scope.song = data.song;
- $scope.selectedPodcast = data.selectedPodcast;
- });
+ $scope.getPodcast = function (action, id) {
+ var promise = subsonic.getPodcast(id);
+ $scope.requestSongs(promise, action);
+
+ $scope.song = [];
+ $scope.album = [];
+ $scope.BreadCrumbs = null;
+ $scope.selectedAutoAlbum = null;
+ $scope.selectedArtist = null;
+ $scope.selectedAlbum = null;
+ $scope.selectedAutoPlaylist = null;
+ $scope.selectedPlaylist = null;
+ $scope.selectedPodcast = id;
};
+
$scope.getMusicFolders = function () {
$.ajax({
url: globals.BaseURL() + '/getMusicFolders.view?' + globals.BaseParams(),
@@ -585,7 +612,7 @@ angular.module('jamstash.subsonic.controller', ['jamstash.subsonic.service', 'ja
$scope.playSong = function (song) {
player.play(song);
};
- $scope.addSongToQueue = function(song) {
+ $scope.addSongToQueue = function (song) {
player.addSong(song);
};
diff --git a/app/subsonic/subsonic_test.js b/app/subsonic/subsonic_test.js
index 420d480..6dd23e7 100644
--- a/app/subsonic/subsonic_test.js
+++ b/app/subsonic/subsonic_test.js
@@ -41,7 +41,8 @@ describe("Subsonic controller", function() {
"getPlaylist",
"newPlaylist",
"deletePlaylist",
- "savePlaylist"
+ "savePlaylist",
+ "getPodcast"
]);
// We make them return different promises and use our deferred variable only when testing
// a particular function, so that they stay isolated
@@ -50,9 +51,6 @@ describe("Subsonic controller", function() {
subsonic.getGenres.and.returnValue($q.defer().promise);
subsonic.getPlaylists.and.returnValue($q.defer().promise);
subsonic.getPodcasts.and.returnValue($q.defer().promise);
- subsonic.getRandomStarredSongs.and.returnValue($q.defer().promise);
- subsonic.getRandomSongs.and.returnValue($q.defer().promise);
- subsonic.getPlaylist.and.returnValue($q.defer().promise);
subsonic.showIndex = false;
$controller = _$controller_;
@@ -89,67 +87,132 @@ describe("Subsonic controller", function() {
spyOn(scope, "requestSongs").and.returnValue(deferred.promise);
});
- it("when I request random starred songs, it uses subsonic-service, delegates to requestSongs displaying, adding or playing songs and sets the scope's current playlist", function() {
+ it("when I request random starred songs, then subsonic-service will be called, displaying, adding or playing songs will be delegated to requestSongs and the current playlist will be published to the scope", function() {
+ subsonic.getRandomStarredSongs.and.returnValue(deferred.promise);
+
scope.getRandomStarredSongs('whatever action');
deferred.resolve(response);
scope.$apply();
expect(subsonic.getRandomStarredSongs).toHaveBeenCalled();
expect(scope.requestSongs).toHaveBeenCalledWith(deferred.promise, 'whatever action');
- expect(scope.selectedPlaylist).toBeNull();
+ expect(scope.album).toEqual([]);
+ expect(scope.BreadCrumbs).toBeNull();
+ expect(scope.selectedAutoAlbum).toBeNull();
+ expect(scope.selectedArtist).toBeNull();
+ expect(scope.selectedAlbum).toBeNull();
expect(scope.selectedAutoPlaylist).toBe('starred');
- });
-
- it("when I request random songs from all folders or genres, it uses subsonic-service, delegates to requestSongs displaying, adding or playing songs and sets the scope's current playlist", function() {
- scope.getRandomSongs('whatever action');
- deferred.resolve(response);
- scope.$apply();
-
- expect(subsonic.getRandomSongs).toHaveBeenCalled();
- expect(scope.requestSongs).toHaveBeenCalledWith(deferred.promise, 'whatever action');
expect(scope.selectedPlaylist).toBeNull();
- expect(scope.selectedAutoPlaylist).toBe('random');
+ expect(scope.selectedPodcast).toBeNull();
});
- it("when I request random songs from a given genre, it uses subsonic-service, delegates to requestSongs displaying, adding or playing songs and sets the scope's current playlist", function() {
- scope.getRandomSongs('whatever action', 'Rock');
+ describe("when I request random songs", function() {
+ beforeEach(function() {
+ subsonic.getRandomSongs.and.returnValue(deferred.promise);
+ });
+
+ it("from all folders or genres, then subsonic-service will be called, displaying, adding or playing songs will be delegated to requestSongs and the current playlist will be published to the scope", function() {
+ scope.getRandomSongs('whatever action');
+ deferred.resolve(response);
+ scope.$apply();
+
+ expect(subsonic.getRandomSongs).toHaveBeenCalled();
+ expect(scope.requestSongs).toHaveBeenCalledWith(deferred.promise, 'whatever action');
+ expect(scope.album).toEqual([]);
+ expect(scope.BreadCrumbs).toBeNull();
+ expect(scope.selectedAutoAlbum).toBeNull();
+ expect(scope.selectedArtist).toBeNull();
+ expect(scope.selectedAlbum).toBeNull();
+ expect(scope.selectedAutoPlaylist).toBe('random');
+ expect(scope.selectedPlaylist).toBeNull();
+ expect(scope.selectedPodcast).toBeNull();
+ });
+
+ it("from a given genre, then subsonic-service will be called, displaying, adding or playing songs will be delegated to requestSongs and the current playlist will be published to the scope", function() {
+ scope.getRandomSongs('whatever action', 'Rock');
+ deferred.resolve(response);
+ scope.$apply();
+
+ expect(subsonic.getRandomSongs).toHaveBeenCalledWith('Rock', undefined);
+ expect(scope.requestSongs).toHaveBeenCalledWith(deferred.promise, 'whatever action');
+ expect(scope.album).toEqual([]);
+ expect(scope.BreadCrumbs).toBeNull();
+ expect(scope.selectedAutoAlbum).toBeNull();
+ expect(scope.selectedArtist).toBeNull();
+ expect(scope.selectedAlbum).toBeNull();
+ expect(scope.selectedAutoPlaylist).toBe('Rock');
+ expect(scope.selectedPlaylist).toBeNull();
+ expect(scope.selectedPodcast).toBeNull();
+ });
+
+ it("from a given folder id, then subsonic-service will be called, displaying, adding or playing songs will be delegated to requestSongs and the current playlist will be published to the scope", function() {
+ scope.getRandomSongs('whatever action', '', 1);
+ deferred.resolve(response);
+ scope.$apply();
+
+ expect(subsonic.getRandomSongs).toHaveBeenCalledWith('', 1);
+ expect(scope.requestSongs).toHaveBeenCalledWith(deferred.promise, 'whatever action');
+ expect(scope.album).toEqual([]);
+ expect(scope.BreadCrumbs).toBeNull();
+ expect(scope.selectedAutoAlbum).toBeNull();
+ expect(scope.selectedArtist).toBeNull();
+ expect(scope.selectedAlbum).toBeNull();
+ expect(scope.selectedAutoPlaylist).toBe(1);
+ expect(scope.selectedPlaylist).toBeNull();
+ expect(scope.selectedPodcast).toBeNull();
+ });
+ });
+
+ describe("given a playlist that contained those 3 songs,", function() {
+ beforeEach(function() {
+ subsonic.getPlaylist.and.returnValue(deferred.promise);
+ });
+
+ it("when I request it, then subsonic-service will be called, displaying, adding or playing songs will be delegated to requestSongs and the current playlist will be published to the scope", function() {
+ scope.getPlaylist('whatever action', 1146);
+ deferred.resolve(response);
+ scope.$apply();
+
+ expect(subsonic.getPlaylist).toHaveBeenCalledWith(1146);
+ expect(scope.requestSongs).toHaveBeenCalledWith(deferred.promise, 'whatever action');
+ expect(scope.song).toEqual([]);
+ expect(scope.album).toEqual([]);
+ expect(scope.BreadCrumbs).toBeNull();
+ expect(scope.selectedAutoAlbum).toBeNull();
+ expect(scope.selectedArtist).toBeNull();
+ expect(scope.selectedAlbum).toBeNull();
+ expect(scope.selectedAutoPlaylist).toBeNull();
+ expect(scope.selectedPlaylist).toBe(1146);
+ expect(scope.selectedPodcast).toBeNull();
+ });
+
+ it("when I display it, the number of songs in the playlist will be notified", function() {
+ scope.getPlaylist('display', 1146);
+ deferred.resolve(response);
+ scope.$apply();
+
+ expect(notifications.updateMessage).toHaveBeenCalledWith('3 Song(s) in Playlist', true);
+ });
+ });
+
+ it("given a podcast that contained those 3 songs as episodes, when I request it, then subsonic-service will be called, displaying adding or playing songs will be delegated to requestSongs and the current selected podcast will be published to the scope", function() {
+ subsonic.getPodcast.and.returnValue(deferred.promise);
+
+ scope.getPodcast('whatever action', 45);
deferred.resolve(response);
scope.$apply();
- expect(subsonic.getRandomSongs).toHaveBeenCalledWith('Rock', undefined);
+ expect(subsonic.getPodcast).toHaveBeenCalledWith(45);
expect(scope.requestSongs).toHaveBeenCalledWith(deferred.promise, 'whatever action');
- expect(scope.selectedPlaylist).toBeNull();
- expect(scope.selectedAutoPlaylist).toBe('Rock');
- });
-
- it("when I request random songs from a given folder id, it uses subsonic-service, delegates to requestSongs displaying, adding or playing songs and sets the scope's current playlist", function() {
- scope.getRandomSongs('whatever action', '', 1);
- deferred.resolve(response);
- scope.$apply();
-
- expect(subsonic.getRandomSongs).toHaveBeenCalledWith('', 1);
- expect(scope.requestSongs).toHaveBeenCalledWith(deferred.promise, 'whatever action');
- expect(scope.selectedPlaylist).toBeNull();
- expect(scope.selectedAutoPlaylist).toBe(1);
- });
-
- it("given a playlist that contains those 3 songs, when I request it, it uses subsonic-service, delegates to requestSongs displaying, adding or playing the songs of the playlist and sets the scope's current playlist", function() {
- scope.getPlaylist('whatever action', 1146);
- deferred.resolve(response);
- scope.$apply();
-
- expect(subsonic.getPlaylist).toHaveBeenCalledWith(1146);
- expect(scope.requestSongs).toHaveBeenCalledWith(deferred.promise, 'whatever action');
- expect(scope.selectedPlaylist).toBe(1146);
+ expect(scope.song).toEqual([]);
+ expect(scope.album).toEqual([]);
+ expect(scope.BreadCrumbs).toBeNull();
+ expect(scope.selectedAutoAlbum).toBeNull();
+ expect(scope.selectedArtist).toBeNull();
+ expect(scope.selectedAlbum).toBeNull();
expect(scope.selectedAutoPlaylist).toBeNull();
- });
-
- it("given a playlist that contained those 3 songs, when I display it, it will notify the user with the number of songs in the playlist", function() {
- scope.getPlaylist('display', 1146);
- deferred.resolve(response);
- scope.$apply();
-
- expect(notifications.updateMessage).toHaveBeenCalledWith('3 Song(s) in Playlist', true);
+ expect(scope.selectedPlaylist).toBeNull();
+ expect(scope.selectedPodcast).toBe(45);
});
});