add track test

This commit is contained in:
Sayem Chowdhury 2021-03-20 21:09:40 +06:00
parent b03f08e444
commit 09a38ea452
1 changed files with 18 additions and 0 deletions

View File

@ -155,6 +155,24 @@ if (process.env.CI) {
t.is(trackWithMetadata.length, 3629256);
});
test('TRACK128 WITHOUT ALBUM INFO', async (t) => {
const track = await api.getTrackInfo('912254892');
const url = getTrackDownloadUrl(track, 1);
const {data} = await axios.get(url, {responseType: 'arraybuffer'});
t.truthy(data);
t.true(Buffer.isBuffer(data));
t.is(data.length, 3262170);
const decryptedTrack = decryptDownload(data, track.SNG_ID);
t.true(Buffer.isBuffer(decryptedTrack));
t.is(decryptedTrack.length, 3262170);
const trackWithMetadata = await api.addTrackTags(decryptedTrack, track, 500);
t.true(Buffer.isBuffer(trackWithMetadata));
t.is(trackWithMetadata.length, 3309066);
});
test('DOWNLOAD TRACK320 & ADD METADATA', async (t) => {
const track = await api.getTrackInfo(SNG_ID);
const url = getTrackDownloadUrl(track, 3);