mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-07-02 21:52:48 +00:00
refactor: rewrite search suggestions logic (#92)
* refactor: rewrite YouTube Music search suggestions The search suggestions method can be found under `Innertube#music.getSearchSuggestions(query)` * feat: allow `execute(..)` to return parsed data This simplifies how response data is handled and also makes it easier for end users to write custom functionality. * style: lint code * chore: change a few things * refactor: rewrite YouTube search suggestions * chore(package): build * chore: update type declarations * chore: fix tests
This commit is contained in:
@@ -29,13 +29,13 @@ describe('YouTube.js Tests', () => {
|
||||
});
|
||||
|
||||
it('Should retrieve YouTube search suggestions', async () => {
|
||||
const suggestions = await this.session.getSearchSuggestions(Constants.VIDEOS[0].QUERY, { client: 'YOUTUBE' });
|
||||
expect(suggestions.results.length).toBeLessThanOrEqual(10);
|
||||
const suggestions = await this.session.getSearchSuggestions(Constants.VIDEOS[0].QUERY);
|
||||
expect(suggestions.length).toBeLessThanOrEqual(10);
|
||||
});
|
||||
|
||||
it('Should retrieve YouTube Music search suggestions', async () => {
|
||||
const suggestions = await this.session.getSearchSuggestions(Constants.VIDEOS[1].QUERY, { client: 'YTMUSIC' });
|
||||
expect(suggestions.results.length).toBeLessThanOrEqual(10);
|
||||
const suggestions = await this.session.music.getSearchSuggestions(Constants.VIDEOS[1].QUERY);
|
||||
expect(suggestions.length).toBeLessThanOrEqual(10);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user