forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction_item_copy_with_test.dart
More file actions
34 lines (29 loc) · 1.1 KB
/
Copy pathaction_item_copy_with_test.dart
File metadata and controls
34 lines (29 loc) · 1.1 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
import 'package:flutter_test/flutter_test.dart';
import 'package:omi/backend/schema/action_item.dart';
import 'package:omi/backend/schema/gen/action_items_folders_wire.g.dart' as wire;
wire.GeneratedActionItemResponse _sampleItem({String? goalId, String? workstreamId}) {
final now = DateTime.utc(2026, 1, 1);
return wire.GeneratedActionItemResponse(
id: 'task_1',
description: 'Follow up',
completed: false,
createdAt: now,
updatedAt: now,
goalId: goalId,
workstreamId: workstreamId,
);
}
void main() {
test('copyWith preserves goalId and workstreamId when omitted', () {
final item = _sampleItem(goalId: 'goal_1', workstreamId: 'ws_1');
final updated = item.copyWith(description: 'Updated');
expect(updated.goalId, 'goal_1');
expect(updated.workstreamId, 'ws_1');
});
test('copyWith allows explicitly clearing goalId and workstreamId', () {
final item = _sampleItem(goalId: 'goal_1', workstreamId: 'ws_1');
final updated = item.copyWith(goalId: null, workstreamId: null);
expect(updated.goalId, isNull);
expect(updated.workstreamId, isNull);
});
}