combine.fm/test/services/deezer.js

65 lines
1.9 KiB
JavaScript
Raw Permalink Normal View History

2025-05-20 13:18:38 +01:00
import "should";
import * as deezer from "../../lib/services/deezer/index.js";
2014-12-04 21:00:34 +00:00
2025-05-20 13:18:38 +01:00
describe("Deezer", () => {
describe("lookupId", () => {
it("should find album by ID", async function test() {
const result = await deezer.lookupId("302127", "album");
result.name.should.equal("Discovery");
2014-12-04 21:00:34 +00:00
});
2025-05-20 13:18:38 +01:00
it("should find track by ID", async function() {
const result = await deezer.lookupId("3135554", "track");
result.name.should.equal("Aerodynamic");
2014-12-04 21:00:34 +00:00
});
});
2025-05-20 13:18:38 +01:00
describe("search", () => {
it("should find album by search", async function() {
const result = await deezer.search({
type: "album",
artist: { name: "Jamie xx" },
name: "In Colour"
});
result.name.should.startWith("In Colour");
2014-12-04 21:00:34 +00:00
});
2025-05-20 13:18:38 +01:00
it("should find album with various artists by search", async function() {
const result = await deezer.search({
type: "album",
artist: { name: "Various Artists" },
name: "Rocket League x Monstercat Vol. 6"
});
result.name.should.equal("Rocket League x Monstercat Vol. 6");
2017-05-07 20:57:12 +01:00
});
2025-05-20 13:18:38 +01:00
it("should find track by search", async function() {
const result = await deezer.search({
type: "track",
artist: { name: "Deftones" },
albumName: "Deftones",
name: "Hexagram"
});
result.name.should.equal("Hexagram");
2014-12-04 21:00:34 +00:00
});
});
2025-05-20 13:18:38 +01:00
describe("lookupUrl", () => {
describe("parseUrl", () => {
it("should parse album url into ID", async function() {
const result = await deezer.parseUrl(
"http://www.deezer.com/album/302127"
);
2015-06-03 21:45:54 -07:00
result.id.should.equal(302127);
2014-12-04 21:00:34 +00:00
});
2025-05-20 13:18:38 +01:00
it("should parse track url into ID", async function() {
const result = await deezer.parseUrl(
"http://www.deezer.com/track/3135554"
);
2015-06-03 21:45:54 -07:00
result.id.should.equal(3135554);
2014-12-04 21:00:34 +00:00
});
});
});
});