forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustom_stt_config_test.dart
More file actions
36 lines (28 loc) · 1.37 KB
/
Copy pathcustom_stt_config_test.dart
File metadata and controls
36 lines (28 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import 'package:flutter_test/flutter_test.dart';
import 'package:omi/models/custom_stt_config.dart';
import 'package:omi/models/stt_provider.dart';
void main() {
group('CustomSttConfig raw audio forwarding', () {
test('legacy configs keep forwarding raw audio to Omi', () {
final config = CustomSttConfig.fromJson({'provider': 'customLive'});
expect(config.toJson()['send_raw_audio_to_omi'], isTrue);
});
test('disabled forwarding survives a JSON round trip', () {
final config = CustomSttConfig.fromJson({'provider': 'customLive', 'send_raw_audio_to_omi': false});
expect(config.toJson()['send_raw_audio_to_omi'], isFalse);
});
test('forwarding policy participates in the config identity', () {
final forwarding = CustomSttConfig.fromJson({'provider': 'customLive', 'send_raw_audio_to_omi': true});
final transcriptOnly = CustomSttConfig.fromJson({'provider': 'customLive', 'send_raw_audio_to_omi': false});
expect(forwarding.sttConfigId, isNot(transcriptOnly.sttConfigId));
});
test('identity override is the socket id without entering JSON', () {
const config = CustomSttConfig(
provider: SttProvider.onDeviceWhisper,
identity: 'freemium:on-device',
);
expect(config.sttConfigId, 'freemium:on-device');
expect(config.toJson().containsKey('identity'), isFalse);
});
});
}