Some service api fixes

This commit is contained in:
Jonathan Cremin 2025-05-20 13:18:38 +01:00
parent 2225712d5f
commit 3ea715de39
6 changed files with 425 additions and 249 deletions

View file

@ -1,45 +1,62 @@
import 'should';
import * as deezer from '../../lib/services/deezer/index.js';
import "should";
import * as deezer from "../../lib/services/deezer/index.js";
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');
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");
});
it('should find track by ID', async function (){
const result = await deezer.lookupId('3135554', 'track');
result.name.should.equal('Aerodynamic');
it("should find track by ID", async function() {
const result = await deezer.lookupId("3135554", "track");
result.name.should.equal("Aerodynamic");
});
});
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');
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");
});
it('should find album with various artists by search', async function (){
const result = await deezer.search({type: 'album', artist: {name: 'Various Artists'}, name: 'The Trevor Nelson Collection'});
result.name.should.equal('The Trevor Nelson Collection');
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");
});
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');
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");
});
});
describe('lookupUrl', () => {
describe('parseUrl', () => {
it('should parse album url into ID', async function (){
const result = await deezer.parseUrl('http://www.deezer.com/album/302127');
describe("lookupUrl", () => {
describe("parseUrl", () => {
it("should parse album url into ID", async function() {
const result = await deezer.parseUrl(
"http://www.deezer.com/album/302127"
);
result.id.should.equal(302127);
});
it('should parse track url into ID', async function (){
const result = await deezer.parseUrl('http://www.deezer.com/track/3135554');
it("should parse track url into ID", async function() {
const result = await deezer.parseUrl(
"http://www.deezer.com/track/3135554"
);
result.id.should.equal(3135554);
});
});