58 lines
1.6 KiB
Dart
58 lines
1.6 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:yumi/app/constants/sc_room_msg_type.dart';
|
|
import 'package:yumi/services/audio/rtm_manager.dart';
|
|
|
|
void main() {
|
|
test('refreshes contribution for a gift in the current room', () {
|
|
expect(
|
|
shouldRefreshRoomContributionForGiftMessage(
|
|
messageType: SCRoomMsgType.gift,
|
|
messageRoomId: 'room-1',
|
|
messageGroupId: 'group-1',
|
|
currentRoomId: 'room-1',
|
|
currentRoomGroupId: 'group-1',
|
|
),
|
|
isTrue,
|
|
);
|
|
});
|
|
|
|
test('refreshes contribution for a lucky gift in the current group', () {
|
|
expect(
|
|
shouldRefreshRoomContributionForGiftMessage(
|
|
messageType: SCRoomMsgType.luckGiftAnimOther,
|
|
messageRoomId: '["user-1"]',
|
|
messageGroupId: 'group-1',
|
|
currentRoomId: 'room-1',
|
|
currentRoomGroupId: 'group-1',
|
|
),
|
|
isTrue,
|
|
);
|
|
});
|
|
|
|
test('does not refresh contribution for another room', () {
|
|
expect(
|
|
shouldRefreshRoomContributionForGiftMessage(
|
|
messageType: SCRoomMsgType.gift,
|
|
messageRoomId: 'room-2',
|
|
messageGroupId: 'group-2',
|
|
currentRoomId: 'room-1',
|
|
currentRoomGroupId: 'group-1',
|
|
),
|
|
isFalse,
|
|
);
|
|
});
|
|
|
|
test('does not refresh contribution for non-gift messages', () {
|
|
expect(
|
|
shouldRefreshRoomContributionForGiftMessage(
|
|
messageType: SCRoomMsgType.text,
|
|
messageRoomId: 'room-1',
|
|
messageGroupId: 'group-1',
|
|
currentRoomId: 'room-1',
|
|
currentRoomGroupId: 'group-1',
|
|
),
|
|
isFalse,
|
|
);
|
|
});
|
|
}
|