-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathtest-065-link-types.js
More file actions
43 lines (39 loc) · 1.64 KB
/
test-065-link-types.js
File metadata and controls
43 lines (39 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var sp = require('../lib/libspotify');
var testutil = require('./util');
var session = null;
exports.links = {
setUp: function(cb) {
testutil.getDefaultTestSession(function(s) {
session = s;
cb();
});
},
'get link type with non-string throw': function(test) {
test.throws(function() {
sp.getLinkType({});
}, "Getting link type from anything else than string should throw");
test.done();
},
'get link type with invalid url throws': function(test) {
test.throws(function() {
sp.getLinkType('not a url');
}, "Getting link type should throw with invalid links");
test.done();
},
'get link type': function (test) {
test.throws(function() {
sp.getLinkType({});
}, "Getting link type from anything else than string should throw");
var track_link = 'spotify:track:4BdSLkzKO6iMVCgw7A7JBl';
var album_link = 'spotify:album:2UGJa9DjYhXpBDKsCTyhSh';
var artist_link = 'spotify:artist:3zD5liDjbqljSRorrrcEjs';
var playlist_link = 'spotify:user:flobyiv:playlist:5ZMnMnJWGXZ9qm4gacHpQF';
test.doesNotThrow(function() {
test.equal('track', sp.getLinkType(track_link), "Link type should be 'track'");
test.equal('album', sp.getLinkType(album_link), "Link type should be 'album'");
test.equal('artist', sp.getLinkType(artist_link), "Link type should be 'artist'");
test.equal('playlist', sp.getLinkType(playlist_link), "Link type should be 'playlist'");
}, "Getting link types should not throw");
test.done();
}
};