forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess_in_progress_conversation_test.dart
More file actions
30 lines (28 loc) · 1.3 KB
/
Copy pathprocess_in_progress_conversation_test.dart
File metadata and controls
30 lines (28 loc) · 1.3 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
import 'package:flutter_test/flutter_test.dart';
import 'package:omi/backend/http/api/conversations.dart';
/// Regression test for #9241: processInProgressConversation() used to
/// crash-report every non-200 response from POST /v1/conversations. A benign
/// 404 — raised when the WS auto-finalize path already consumed the
/// in-progress conversation and cleared its Redis pointer before this
/// client-initiated create ran — flooded crash reporting for a race with no
/// user-visible impact (the conversation was already finalized).
///
/// The production code branches on isBenignInProgressConversationCreateStatus,
/// so exercising that predicate covers the crash-vs-skip decision without the
/// non-injectable makeApiCall / crashReporter singletons.
void main() {
group('isBenignInProgressConversationCreateStatus', () {
test('404 is benign (WS already finalized the conversation) — no crash', () {
expect(isBenignInProgressConversationCreateStatus(404), isTrue);
});
test('genuine failures still report a crash', () {
for (final status in [304, 400, 401, 409, 429, 500, 502, 503]) {
expect(
isBenignInProgressConversationCreateStatus(status),
isFalse,
reason: 'status $status should not be treated as benign',
);
}
});
});
}