mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 16:30:28 +00:00
fix: Align contact sorting labels #0
This commit is contained in:
35
test/models/channel_test.dart
Normal file
35
test/models/channel_test.dart
Normal file
@@ -0,0 +1,35 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:meshcore_sar_app/models/channel.dart';
|
||||
|
||||
void main() {
|
||||
test('hash channels expose deterministic psk_base64', () {
|
||||
final channel = Channel.create(index: 3, name: '#ops');
|
||||
|
||||
expect(channel.isHashChannel, isTrue);
|
||||
expect(channel.pskBase64, 'O2RN43fDLHh5NgWiWqkVvw==');
|
||||
expect(
|
||||
Channel.pskBase64ForHashChannelName('#ops'),
|
||||
'O2RN43fDLHh5NgWiWqkVvw==',
|
||||
);
|
||||
});
|
||||
|
||||
test('normal channels reject derived hashtag psk export helper', () {
|
||||
expect(
|
||||
() => Channel.pskBase64ForHashChannelName('ops'),
|
||||
throwsArgumentError,
|
||||
);
|
||||
});
|
||||
|
||||
test('normal channels still expose their stored psk_base64', () {
|
||||
final channel = Channel.create(
|
||||
index: 4,
|
||||
name: 'ops',
|
||||
explicitSecret: Uint8List.fromList(List<int>.generate(16, (i) => i)),
|
||||
);
|
||||
|
||||
expect(channel.isHashChannel, isFalse);
|
||||
expect(channel.pskBase64, 'AAECAwQFBgcICQoLDA0ODw==');
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user