-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84d8d9a
commit eda0a89
Showing
4 changed files
with
81 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* @jest-environment node | ||
*/ | ||
|
||
import scdl, { search } from '../' | ||
|
||
describe('related()', () => { | ||
const limit = 10 | ||
let searchResponse | ||
|
||
beforeAll(async () => { | ||
try { | ||
searchResponse = await scdl.related('tracks', 170286204, limit, 0) | ||
} catch (err) { | ||
console.log(err) | ||
process.exit(1) | ||
} | ||
}) | ||
|
||
it('returns a valid SearchResponse object', () => { | ||
const keys = ['collection', 'next_href', 'variant', 'query_urn'].forEach(key => expect(searchResponse[key]).toBeDefined()) | ||
}) | ||
|
||
it('resource count returned is equal to limit', () => { | ||
expect(searchResponse.collection.length).toEqual(limit) | ||
}) | ||
|
||
it('resource returned corresponds to type parameter', () => { | ||
searchResponse.collection.forEach(track => { | ||
expect(track.title).toBeDefined() | ||
expect(track.media).toBeDefined() | ||
}) | ||
}) | ||
}) |