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,46 +1,54 @@
import 'should';
import * as itunes from '../../lib/services/itunes/index.js';
import "should";
import * as itunes from "../../lib/services/itunes/index.js";
describe('iTunes Music', function(){
describe('lookupId', function(){
it('should find album by ID', async function (){
const result = await itunes.lookupId('1445991287', 'album');
result.name.should.equal('Peace Orchestra');
describe("iTunes Music", function() {
describe("lookupId", function() {
it("should find album by ID", async function() {
const result = await itunes.lookupId("1445991287", "album");
result.name.should.equal("Peace Orchestra");
});
it('should find track by ID', async function (){
const result = await itunes.lookupId('1445927701', 'track');
result.name.should.equal('Double Drums');
it("should find track by ID", async function() {
const result = await itunes.lookupId("1440718994", "track");
result.name.should.equal("Zombie");
});
});
describe('search', function(){
it('should find album by search', async function (){
const result = await itunes.search({type: 'album', artist: {name: 'Deftones'}, name: 'White Pony'});
result.name.should.equal('White Pony');
describe("search", function() {
it("should find album by search", async function() {
const result = await itunes.search({
type: "album",
artist: { name: "Deftones" },
name: "White Pony"
});
result.name.should.equal("White Pony");
});
it('should find awkward album by search', async function (){
const result = await itunes.search({type: 'album', artist: {name: 'Anavitória'}, name: 'Fica'});
result.name.should.equal('Fica (feat. Matheus & Kauan) - Single');
});
it('should find track by search', async function (){
const result = await itunes.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 itunes.search({
type: "track",
artist: { name: "Deftones" },
albumName: "Deftones",
name: "Hexagram"
});
result.name.should.equal("Hexagram");
});
});
describe('lookupUrl', function(){
describe('parseUrl', function(){
it('should parse album url into ID', async function (){
const result = await itunes.parseUrl('https://itunes.apple.com/us/album/peace-orchestra/1445991287');
result.id.should.equal('us1445991287');
describe("lookupUrl", function() {
describe("parseUrl", function() {
it("should parse album url into ID", async function() {
const result = await itunes.parseUrl(
"https://itunes.apple.com/us/album/peace-orchestra/1445991287"
);
result.id.should.equal("us1445991287");
});
it('should parse track url into ID', async function (){
const result = await itunes.parseUrl('https://itunes.apple.com/us/album/double-drums-dj-dsl-mix/1445927689?i=1445927701');
result.id.should.equal('us1445927689');
it("should parse track url into ID", async function() {
const result = await itunes.parseUrl(
"https://itunes.apple.com/us/album/double-drums-dj-dsl-mix/1445927689?i=1445927701"
);
result.id.should.equal("us1445927689");
});
});
});