-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TW-2018 Changed powerlevels in group chats
- Loading branch information
1 parent
f8d3a83
commit e9ed8fb
Showing
3 changed files
with
47 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import 'package:fluffychat/utils/power_level_manager.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:fluffychat/config/default_power_level_member.dart'; | ||
import 'package:matrix/matrix.dart'; | ||
|
||
void main() { | ||
group('PowerLevelManager', () { | ||
late PowerLevelManager powerLevelManager; | ||
|
||
setUp(() { | ||
powerLevelManager = PowerLevelManager(); | ||
}); | ||
|
||
test('should return correct power levels for each event type', () { | ||
final userPowerLevel = DefaultPowerLevelMember.user.powerLevel; | ||
final adminPowerLevel = DefaultPowerLevelMember.admin.powerLevel; | ||
final result = powerLevelManager.getDefaultPowerLevelEventForMember(); | ||
|
||
expect(result[EventTypes.RoomPinnedEvents], equals(userPowerLevel)); | ||
expect(result[EventTypes.RoomName], equals(adminPowerLevel)); | ||
expect(result[EventTypes.RoomAvatar], equals(adminPowerLevel)); | ||
expect(result[EventTypes.RoomMember], equals(userPowerLevel)); | ||
expect(result[EventTypes.RoomTopic], equals(adminPowerLevel)); | ||
}); | ||
|
||
test('should contain all expected event types', () { | ||
final result = powerLevelManager.getDefaultPowerLevelEventForMember(); | ||
expect( | ||
result.keys, | ||
containsAll([ | ||
EventTypes.RoomPinnedEvents, | ||
EventTypes.RoomName, | ||
EventTypes.RoomAvatar, | ||
EventTypes.RoomMember, | ||
EventTypes.RoomTopic, | ||
]), | ||
); | ||
}); | ||
}); | ||
} |