Implement WhatsApp share intake and person quick actions
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:relationship_saver/features/share_intake/whatsapp_share_parser.dart';
|
||||
|
||||
void main() {
|
||||
test('parses sender-prefixed WhatsApp text', () {
|
||||
final WhatsAppSharePayload payload = WhatsAppShareParser.parse(
|
||||
'Ava Hart: Lets do coffee on Saturday?',
|
||||
);
|
||||
|
||||
expect(payload.sourceDisplayName, 'Ava Hart');
|
||||
expect(payload.sourceUserId, 'wa:ava hart');
|
||||
expect(payload.messageText, 'Lets do coffee on Saturday?');
|
||||
});
|
||||
|
||||
test('parses bracket timestamp style WhatsApp export line', () {
|
||||
final WhatsAppSharePayload payload = WhatsAppShareParser.parse(
|
||||
'[2/17/26, 22:41] Jordan Lee: Finished 5k today!',
|
||||
);
|
||||
|
||||
expect(payload.sourceDisplayName, 'Jordan Lee');
|
||||
expect(payload.sourceUserId, 'wa:jordan lee');
|
||||
expect(payload.messageText, 'Finished 5k today!');
|
||||
});
|
||||
|
||||
test('falls back to raw message when sender cannot be detected', () {
|
||||
const String raw = 'Remember to ask about her interview tomorrow.';
|
||||
final WhatsAppSharePayload payload = WhatsAppShareParser.parse(raw);
|
||||
|
||||
expect(payload.sourceDisplayName, isNull);
|
||||
expect(payload.sourceUserId, isNull);
|
||||
expect(payload.messageText, raw);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user