|
|
|
@ -39,10 +39,11 @@ describe('POST /query with no songs', () => { |
|
|
|
|
}, |
|
|
|
|
'ordering': { |
|
|
|
|
'orderBy': { |
|
|
|
|
'type': 0, |
|
|
|
|
'type': 'name', |
|
|
|
|
}, |
|
|
|
|
'ascending': true |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
'responseType': 'details', |
|
|
|
|
}) |
|
|
|
|
expect(res).to.have.status(200); |
|
|
|
|
expect(res.body).to.deep.equal({ |
|
|
|
@ -114,10 +115,11 @@ describe('POST /query with several songs and filters', () => { |
|
|
|
|
}, |
|
|
|
|
'ordering': { |
|
|
|
|
'orderBy': { |
|
|
|
|
'type': 0, |
|
|
|
|
'type': 'name', |
|
|
|
|
}, |
|
|
|
|
'ascending': true |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
'responseType': 'details', |
|
|
|
|
}) |
|
|
|
|
.then((res) => { |
|
|
|
|
expect(res).to.have.status(200); |
|
|
|
@ -145,10 +147,11 @@ describe('POST /query with several songs and filters', () => { |
|
|
|
|
}, |
|
|
|
|
'ordering': { |
|
|
|
|
'orderBy': { |
|
|
|
|
'type': 0, |
|
|
|
|
'type': 'name', |
|
|
|
|
}, |
|
|
|
|
'ascending': true |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
'responseType': 'details', |
|
|
|
|
}) |
|
|
|
|
.then((res) => { |
|
|
|
|
expect(res).to.have.status(200); |
|
|
|
@ -176,10 +179,11 @@ describe('POST /query with several songs and filters', () => { |
|
|
|
|
}, |
|
|
|
|
'ordering': { |
|
|
|
|
'orderBy': { |
|
|
|
|
'type': 0, |
|
|
|
|
'type': 'name', |
|
|
|
|
}, |
|
|
|
|
'ascending': true |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
'responseType': 'details', |
|
|
|
|
}) |
|
|
|
|
.then((res) => { |
|
|
|
|
expect(res).to.have.status(200); |
|
|
|
@ -207,10 +211,11 @@ describe('POST /query with several songs and filters', () => { |
|
|
|
|
}, |
|
|
|
|
'ordering': { |
|
|
|
|
'orderBy': { |
|
|
|
|
'type': 0, |
|
|
|
|
'type': 'name', |
|
|
|
|
}, |
|
|
|
|
'ascending': true |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
'responseType': 'details', |
|
|
|
|
}) |
|
|
|
|
.then((res) => { |
|
|
|
|
expect(res).to.have.status(200); |
|
|
|
@ -248,10 +253,11 @@ describe('POST /query with several songs and filters', () => { |
|
|
|
|
}, |
|
|
|
|
'ordering': { |
|
|
|
|
'orderBy': { |
|
|
|
|
'type': 0, |
|
|
|
|
'type': 'name', |
|
|
|
|
}, |
|
|
|
|
'ascending': true |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
'responseType': 'details', |
|
|
|
|
}) |
|
|
|
|
.then((res) => { |
|
|
|
|
expect(res).to.have.status(200); |
|
|
|
@ -279,10 +285,11 @@ describe('POST /query with several songs and filters', () => { |
|
|
|
|
}, |
|
|
|
|
'ordering': { |
|
|
|
|
'orderBy': { |
|
|
|
|
'type': 0, |
|
|
|
|
'type': 'name', |
|
|
|
|
}, |
|
|
|
|
'ascending': true |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
'responseType': 'details', |
|
|
|
|
}) |
|
|
|
|
.then((res) => { |
|
|
|
|
expect(res).to.have.status(200); |
|
|
|
@ -295,6 +302,62 @@ describe('POST /query with several songs and filters', () => { |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async function checkResponseTypeIds(req) { |
|
|
|
|
await req |
|
|
|
|
.post('/query') |
|
|
|
|
.send({ |
|
|
|
|
"query": {}, |
|
|
|
|
'offsetsLimits': { |
|
|
|
|
'songOffset': 0, |
|
|
|
|
'songLimit': 10, |
|
|
|
|
}, |
|
|
|
|
'ordering': { |
|
|
|
|
'orderBy': { |
|
|
|
|
'type': 'name', |
|
|
|
|
}, |
|
|
|
|
'ascending': true |
|
|
|
|
}, |
|
|
|
|
'responseType': 'ids', |
|
|
|
|
}) |
|
|
|
|
.then((res) => { |
|
|
|
|
expect(res).to.have.status(200); |
|
|
|
|
expect(res.body).to.deep.equal({ |
|
|
|
|
songs: [song1.songId, song2.songId, song3.songId], |
|
|
|
|
artists: [], |
|
|
|
|
tags: [], |
|
|
|
|
albums: [], |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async function checkResponseTypeCount(req) { |
|
|
|
|
await req |
|
|
|
|
.post('/query') |
|
|
|
|
.send({ |
|
|
|
|
"query": {}, |
|
|
|
|
'offsetsLimits': { |
|
|
|
|
'songOffset': 0, |
|
|
|
|
'songLimit': 10, |
|
|
|
|
}, |
|
|
|
|
'ordering': { |
|
|
|
|
'orderBy': { |
|
|
|
|
'type': 'name', |
|
|
|
|
}, |
|
|
|
|
'ascending': true |
|
|
|
|
}, |
|
|
|
|
'responseType': 'count', |
|
|
|
|
}) |
|
|
|
|
.then((res) => { |
|
|
|
|
expect(res).to.have.status(200); |
|
|
|
|
expect(res.body).to.deep.equal({ |
|
|
|
|
songs: 3, |
|
|
|
|
artists: 0, |
|
|
|
|
tags: 0, |
|
|
|
|
albums: 0, |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let agent = await init(); |
|
|
|
|
let req = agent.keepOpen(); |
|
|
|
|
try { |
|
|
|
@ -309,6 +372,8 @@ describe('POST /query with several songs and filters', () => { |
|
|
|
|
await checkArtistIdIn(req); |
|
|
|
|
await checkOrRelation(req); |
|
|
|
|
await checkStoreLinksLike(req); |
|
|
|
|
await checkResponseTypeCount(req); |
|
|
|
|
await checkResponseTypeIds(req); |
|
|
|
|
} finally { |
|
|
|
|
req.close(); |
|
|
|
|
agent.close(); |
|
|
|
|