1 | require("./common.js");
|
2 | var LastFmInfo = require("lastfm/lastfm-info");
|
3 | var fakes = require("./fakes");
|
4 |
|
5 | describe("a track info request")
|
6 | before(function() {
|
7 | this.gently = new Gently();
|
8 | this.lastfm = new LastFmNode();
|
9 | });
|
10 |
|
11 | it("calls method track.getInfo", function() {
|
12 | this.gently.expect(this.lastfm, "read", function(params, signed) {
|
13 | assert.equal("track.getinfo", params.method);
|
14 | return new fakes.LastFmRequest();
|
15 | });
|
16 | new LastFmInfo(this.lastfm, "track", { mbid: "mbid" });
|
17 | });
|
18 |
|
19 | it("can accept artist, track name and mbid", function() {
|
20 | this.gently.expect(this.lastfm, "read", function(params) {
|
21 | assert.equal("The Mae Shi", params.artist);
|
22 | assert.equal("Run To Your Grave", params.track);
|
23 | assert.equal("1234567890", params.mbid);
|
24 | return new fakes.LastFmRequest();
|
25 | });
|
26 | new LastFmInfo(this.lastfm, "track", {
|
27 | artist: "The Mae Shi",
|
28 | track: "Run To Your Grave",
|
29 | mbid: "1234567890"
|
30 | });
|
31 | });
|
32 |
|
33 | it("can accept basic track object", function() {
|
34 | this.gently.expect(this.lastfm, "read", function(params) {
|
35 | assert.equal("The Mae Shi", params.artist);
|
36 | assert.equal("Run To Your Grave", params.track);
|
37 | assert.equal("fakembid", params.mbid);
|
38 | return new fakes.LastFmRequest();
|
39 | });
|
40 | new LastFmInfo(this.lastfm, "track", { track: FakeTracks.RunToYourGrave });
|
41 | });
|