Skip to content

Commit

Permalink
Began tests for lastFm.search()
Browse files Browse the repository at this point in the history
  • Loading branch information
rattletone committed Mar 5, 2019
1 parent 52012a1 commit b4d5a59
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions __test__/LastFm.test.js
Expand Up @@ -1231,4 +1231,52 @@ describe("LastFm", () => {
done();
});
});

test("search for an album, artist, and track", done => {
const lastFm = new LastFm({ apiKey, secret, sessionKey });

nock("http://ws.audioscrobbler.com")
.get("/2.0/")
.query({
"api_key": apiKey,
"format": "json",
"method": "album.search"
})
.reply(200, { "status": "ok" });

nock("http://ws.audioscrobbler.com")
.get("/2.0/")
.query({
"api_key": apiKey,
"format": "json",
"method": "artist.search"
})
.reply(200, { "status": "ok" });

nock("http://ws.audioscrobbler.com")
.get("/2.0/")
.query({
"api_key": apiKey,
"format": "json",
"method": "track.search"
})
.reply(200, { "status": "ok" });

lastFm.search({}, (err, data) => {
expect(err).toBeNull();
expect(data).toEqual({
"album": {
"status": "ok"
},
"artist": {
"status": "ok"
},
"track": {
"status": "ok"
}
});

done();
});
});
});

0 comments on commit b4d5a59

Please sign in to comment.