Skip to content

Commit

Permalink
Fix bug breaking use of app_client_id parameter [#6]
Browse files Browse the repository at this point in the history
  • Loading branch information
watsonbox committed Jul 3, 2015
1 parent 7147981 commit 7db76bf
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion exportify.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ window.Helpers = {

window.location = "https://accounts.spotify.com/authorize" +
"?client_id=" + client_id +
"&redirect_uri=" + encodeURIComponent(document.location.href) +
"&redirect_uri=" + encodeURIComponent([location.protocol, '//', location.host, location.pathname].join('')) +
"&scope=playlist-read-private%20playlist-read-collaborative" +
"&response_type=token";
},
Expand Down
25 changes: 25 additions & 0 deletions test/integration/exportify_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,31 @@ casper.test.begin("Testing initial authentication redirect", 2, function(test) {
});
});

casper.test.begin("Testing initial authentication redirect with different client id", 2, function(test) {
casper.start('http://localhost:8080/exportify.html?app_client_id=123456');

casper.waitUntilVisible('#loginButton', function() {
test.assertTitle("Exportify", "Exportify main page is loaded");
this.click('#loginButton');
})

casper.then(function() {
test.assertEquals(
lastRequestedURL,
"https://accounts.spotify.com/authorize?" +
"client_id=123456&" +
"redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fexportify.html&" +
"scope=playlist-read-private playlist-read-collaborative&" +
"response_type=token",
"Redirected to Spotify authentication page"
);
});

casper.run(function() {
test.done();
});
});

casper.test.begin("Testing loading and displaying playlists", 10, function(test) {
casper.viewport(1000, 1000);

Expand Down

0 comments on commit 7db76bf

Please sign in to comment.