diff --git a/test/apis/twitch_api_test.dart b/test/apis/twitch_api_test.dart index 7727e23f..9e568585 100644 --- a/test/apis/twitch_api_test.dart +++ b/test/apis/twitch_api_test.dart @@ -35,6 +35,63 @@ void main() { }); }); + group('getUserEmotes', () { + test('returns every page including Hype Train emotes', () async { + dioAdapter.onGet( + 'https://api.twitch.tv/helix/chat/emotes/user', + (server) => server.reply(200, { + 'data': [ + { + 'id': '304420818', + 'name': 'HypeLol', + 'emote_type': 'hypetrain', + 'emote_set_id': '', + 'owner_id': '477339272', + }, + ], + 'pagination': {'cursor': 'next-page'}, + }), + queryParameters: { + 'user_id': '12345', + 'broadcaster_id': '67890', + 'first': 100, + }, + ); + dioAdapter.onGet( + 'https://api.twitch.tv/helix/chat/emotes/user', + (server) => server.reply(200, { + 'data': [ + { + 'id': 'subscriber-1', + 'name': 'ChannelLove', + 'emote_type': 'subscriptions', + 'emote_set_id': 'set-1', + 'owner_id': '67890', + }, + ], + 'pagination': {}, + }), + queryParameters: { + 'user_id': '12345', + 'broadcaster_id': '67890', + 'first': 100, + 'after': 'next-page', + }, + ); + + final emotes = await api.getUserEmotes( + userId: '12345', + broadcasterId: '67890', + ); + + expect(emotes, hasLength(2)); + expect(emotes[0].name, 'HypeLol'); + expect(emotes[0].type, EmoteType.twitchUnlocked); + expect(emotes[1].name, 'ChannelLove'); + expect(emotes[1].type, EmoteType.twitchSub); + }); + }); + group('getBadgesGlobal', () { test('returns map of badge set/version to ChatBadge', () async { dioAdapter.onGet( diff --git a/test/utils/twitch_oauth_scopes_test.dart b/test/utils/twitch_oauth_scopes_test.dart index 94723f66..ea61ecc3 100644 --- a/test/utils/twitch_oauth_scopes_test.dart +++ b/test/utils/twitch_oauth_scopes_test.dart @@ -9,6 +9,7 @@ void main() { } expect(twitchAllUserScopes, containsAll(twitchUserScopes)); expect(twitchAllUserScopes, containsAll(twitchModeratorScopes)); + expect(twitchUserScopes, contains('user:read:emotes')); }); });