Files
buzz/mobile/test/features/channels/channel_preferences_manager_test.dart
klopez4212 aeb741fd31 Polish mobile channel navigation and message sends (#6488)
## Summary
- align iOS back controls and affected titles across channel details,
settings, and pairing
- make channel star and mute actions reflect their state immediately
- animate locally sent channel, thread, and DM messages from behind the
composer with a 300ms ease-out

## Testing
- `just mobile-check`
- full mobile test suite (1,573 tests)

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Signed-off-by: Kenny Lopez <klopez4212@gmail.com>
Co-authored-by: Princess Donut <b238ea756dee4d98afa5883fc7f1de61eeabe65bf700e3a5a5a80db5e42e2c2b@buzz.block.builderlab.xyz>
2026-08-21 19:13:16 +01:00

58 lines
1.9 KiB
Dart

import 'package:buzz/features/channels/channel_mutes/channel_mutes_manager.dart';
import 'package:buzz/features/channels/channel_stars/channel_stars_manager.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:nostr/nostr.dart' as nostr;
import 'package:shared_preferences/shared_preferences.dart';
void main() {
setUp(() => SharedPreferences.setMockInitialValues({}));
test('local star changes notify listeners immediately', () async {
final prefs = await SharedPreferences.getInstance();
final keys = nostr.Keys.generate();
var changes = 0;
final manager = ChannelStarsManager(
pubkey: keys.public,
prefs: prefs,
crypto: ChannelStarsCrypto(keys.nsec, keys.public),
relaySession: null,
signedEventRelay: null,
remoteEnabled: false,
onChanged: () => changes += 1,
);
addTearDown(manager.dispose);
manager.starChannel('general');
expect(manager.store.channels['general']?.starred, isTrue);
expect(changes, 1);
manager.unstarChannel('general');
expect(manager.store.channels['general']?.starred, isFalse);
expect(changes, 2);
});
test('local mute changes notify listeners immediately', () async {
final prefs = await SharedPreferences.getInstance();
final keys = nostr.Keys.generate();
var changes = 0;
final manager = ChannelMutesManager(
pubkey: keys.public,
prefs: prefs,
crypto: ChannelMutesCrypto(keys.nsec, keys.public),
relaySession: null,
signedEventRelay: null,
remoteEnabled: false,
onChanged: () => changes += 1,
);
addTearDown(manager.dispose);
manager.muteChannel('general');
expect(manager.store.channels['general']?.muted, isTrue);
expect(changes, 1);
manager.unmuteChannel('general');
expect(manager.store.channels['general']?.muted, isFalse);
expect(changes, 2);
});
}