Skip to content

Commit

Permalink
coverage
Browse files Browse the repository at this point in the history
wip #377
  • Loading branch information
zin- committed Aug 28, 2024
1 parent 8b5a932 commit fd828de
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 92 deletions.
148 changes: 69 additions & 79 deletions integration_test/scenarios/memo/detail_scenarios.dart
Original file line number Diff line number Diff line change
Expand Up @@ -229,94 +229,84 @@ void main() => group(
const archivedMemName = "$insertedMemName - archived";

setUp(() async {
await dbA.insert(
defTableMems,
{
defColMemsName.name: unarchivedMemName,
defColCreatedAt.name: DateTime.now(),
},
);
await dbA.insert(
defTableMems,
{
defColMemsName.name: archivedMemName,
defColCreatedAt.name: DateTime.now(),
defColArchivedAt.name: DateTime.now(),
},
);
final unarchivedMemId = await dbA.insert(defTableMems, {
defColMemsName.name: unarchivedMemName,
defColCreatedAt.name: DateTime.now(),
});
await dbA.insert(defTableMemItems, {
defFkMemItemsMemId.name: unarchivedMemId,
defColMemItemsType.name: MemItemType.memo.name,
defColMemItemsValue.name: insertedMemMemo,
defColCreatedAt.name: zeroDate,
});
final archivedMemId = await dbA.insert(defTableMems, {
defColMemsName.name: archivedMemName,
defColCreatedAt.name: DateTime.now(),
defColArchivedAt.name: DateTime.now(),
});
await dbA.insert(defTableMemItems, {
defFkMemItemsMemId.name: archivedMemId,
defColMemItemsType.name: MemItemType.memo.name,
defColMemItemsValue.name: insertedMemMemo,
defColCreatedAt.name: zeroDate,
});
});

testWidgets(
": archive.",
(widgetTester) async {
await runApplication();
await widgetTester.pumpAndSettle();
await widgetTester.tap(find.text(unarchivedMemName));
await widgetTester.pumpAndSettle();

await widgetTester.tap(find.byIcon(Icons.more_vert));
await widgetTester.pumpAndSettle();

await widgetTester.tap(find.byIcon(Icons.archive));
await widgetTester.pumpAndSettle();

expect(
find.text(unarchivedMemName),
findsNothing,
);
expect(
testWidgets(": archive.", (widgetTester) async {
await runApplication();
await widgetTester.pumpAndSettle();
await widgetTester.tap(find.text(unarchivedMemName));
await widgetTester.pumpAndSettle();

await widgetTester.tap(find.byIcon(Icons.more_vert));
await widgetTester.pumpAndSettle();

await widgetTester.tap(find.byIcon(Icons.archive));
await widgetTester.pumpAndSettle();

expect(find.text(unarchivedMemName), findsNothing);
expect(
find.text(l10n.archiveMemSuccessMessage(unarchivedMemName)),
findsOneWidget,
);
findsOneWidget);

final findUnarchivedMem =
Equals(defColMemsName, unarchivedMemName);
final mems = await dbA.select(
defTableMems,
final findUnarchivedMem =
Equals(defColMemsName, unarchivedMemName);
final mems = await dbA.select(defTableMems,
where: findUnarchivedMem.where(),
whereArgs: findUnarchivedMem.whereArgs(),
);
expect(mems.length, 1);
expect(mems.single[defColArchivedAt.name], isNotNull);
},
);
whereArgs: findUnarchivedMem.whereArgs());
expect(mems.length, 1);
expect(mems.single[defColArchivedAt.name], isNotNull);
});

testWidgets(
": unarchive.",
(widgetTester) async {
await runApplication();
await widgetTester.pumpAndSettle();
await widgetTester.tap(filterListIconFinder);
await widgetTester.pumpAndSettle();
await widgetTester.tap(showArchiveSwitchFinder);
await widgetTester.pumpAndSettle();
await closeMemListFilter(widgetTester);
await widgetTester.pumpAndSettle();
await widgetTester.tap(find.text(archivedMemName));
await widgetTester.pumpAndSettle();

await widgetTester.tap(find.byIcon(Icons.more_vert));
await widgetTester.pumpAndSettle();

await widgetTester.tap(find.byIcon(Icons.unarchive));
await widgetTester.pumpAndSettle();

expect(
testWidgets(": unarchive.", (widgetTester) async {
await runApplication();
await widgetTester.pumpAndSettle();
await widgetTester.tap(filterListIconFinder);
await widgetTester.pumpAndSettle();
await widgetTester.tap(showArchiveSwitchFinder);
await widgetTester.pumpAndSettle();
await closeMemListFilter(widgetTester);
await widgetTester.pumpAndSettle();
await widgetTester.tap(find.text(archivedMemName));
await widgetTester.pumpAndSettle();

await widgetTester.tap(find.byIcon(Icons.more_vert));
await widgetTester.pumpAndSettle();

await widgetTester.tap(find.byIcon(Icons.unarchive));
await widgetTester.pumpAndSettle();

expect(

Check failure on line 299 in integration_test/scenarios/memo/detail_scenarios.dart

View workflow job for this annotation

GitHub Actions / Report (Medium test (Android) (scenarios/app_test.dart)) (reactivecircus)

integration_test/scenarios/app_test.dart ► Scenario test Memo scenario Memo detail scenario : Save : Archive ► : unarchive.

Failed test found in: reports/test_report.log Error: The following TestFailure was thrown running a test: Expected: exactly one matching candidate Actual: _TextWidgetFinder:<Found 0 widgets with text "Unarchive success. Memo detail scenario - mem name: Save: Archive: inserted - archived": []> Which: means none were found but one was expected
Raw output
[T] TIME: 2024-08-14T08:53:17.018374 DatabaseRepository.receive [start] :: {
  entity: Instance of 'DatabaseDefinition': {name: mem.db, version: 7, tableDefinitions: (TableDefinition: {name: mems, columnDefinitions: (TextColumnDefinition: {name: name, type: TEXT, notNull: true, isPrimaryKey: false}, TimestampColumnDefinition: {name: doneAt, type: TIMESTAMP, notNull: false, isPrimaryKey: false}, TimestampColumnDefinition: {name: notifyOn, type: TIMESTAMP, notNull: false, isPrimaryKey: false}, ..., TimestampColumnDefinition: {name: updatedAt, type: TIMESTAMP, notNull: false, isPrimaryKey: false}, TimestampColumnDefinition: {name: archivedAt, type: TIMESTAMP, notNull: false, isPrimaryKey: false}), singularName: mem}, TableDefinition: {name: mem_items, columnDefinitions: (TextColumnDefinition: {name: type, type: TEXT, notNull: true, isPrimaryKey: false}, TextColumnDefinition: {name: value, type: TEXT, notNull: true, isPrimaryKey: false}, ForeignKeyDefinition: {name: mems_id, type: INTEGER, notNull: true, isPrimaryKey: false}, ..., TimestampColumnDefinition: {name: updatedAt, type: TIMESTAMP, notNull: false, isPrimaryKey: false}, TimestampColumnDefinition: {name: archivedAt, type: TIMESTAMP, notNull: false, isPrimaryKey: false}), singularName: null}, TableDefinition: {name: acts, columnDefinitions: (TimestampColumnDefinition: {name: start, type: TIMESTAMP, notNull: true, isPrimaryKey: false}, BooleanColumnDefinition: {name: start_is_all_day, type: INTEGER, notNull: true, isPrimaryKey: false}, TimestampColumnDefinition: {name: end, type: TIMESTAMP, notNull: false, isPrimaryKey: false}, ..., TimestampColumnDefinition: {name: archivedAt, type: TIMESTAMP, notNull: false, isPrimaryKey: false}, ForeignKeyDefinition: {name: mems_id, type: INTEGER, notNull: true, isPrimaryKey: false}), singularName: null}, TableDefinition: {name: mem_repeated_notifications, columnDefinitions: (IntegerColumnDefinition: {name: time_of_day_seconds, type: INTEGER, notNull: true, isPrimaryKey: false}, TextColumnDefinition: {name: type, type: TEXT, notNull: true, isPrimaryKey: false}, TextColumnDefinition: {name: message, type: TEXT, notNull: true, isPrimaryKey: false}, ..., TimestampColumnDefinition: {name: archivedAt, type: TIMESTAMP, notNull: false, isPrimaryKey: false}, ForeignKeyDefinition: {name: mems_id, type: INTEGER, notNull: true, isPrimaryKey: false}), singularName: null})},
}
[T] TIME: 2024-08-14T08:53:17.024963 DatabaseRepository.receive [end] => [future] >> Instance of 'DatabaseAccessor'
[T] TIME: 2024-08-14T08:53:17.037060 DatabaseAccessor.delete [start] :: [
  mem_repeated_notifications,
  null,
  null,
]
[T] TIME: 2024-08-14T08:53:17.078245 DatabaseAccessor.delete [end] => [future] >> 0
[T] TIME: 2024-08-14T08:53:17.094406 DatabaseAccessor.delete [start] :: [
  acts,
  null,
  null,
]
[T] TIME: 2024-08-14T08:53:17.135403 DatabaseAccessor.delete [end] => [future] >> 0
[T] TIME: 2024-08-14T08:53:17.140962 DatabaseAccessor.delete [start] :: [
  mem_items,
  null,
  null,
]
[T] TIME: 2024-08-14T08:53:17.273006 DatabaseAccessor.delete [end] => [future] >> 3
[T] TIME: 2024-08-14T08:53:17.289839 DatabaseAccessor.delete [start] :: [
  mems,
  null,
  null,
]
[T] TIME: 2024-08-14T08:53:17.379306 DatabaseAccessor.delete [end] => [future] >> 3
[T] TIME: 2024-08-14T08:53:17.385559 DatabaseAccessor.insert [start] :: [
  mems,
  {
    name: Memo detail scenario - mem name - inserted,
    createdAt: 0000-01-01 00:00:00.000,
  },
]
[T] TIME: 2024-08-14T08:53:17.485248 DatabaseAccessor.insert [end] => [future] >> 1
[T] TIME: 2024-08-14T08:53:17.501938 DatabaseAccessor.insert [start] :: [
  mem_items,
  {
    mems_id: 1,
    type: memo,
    value: Memo detail scenario - mem memo - inserted,
    createdAt: 0000-01-01 00:00:00.000,
  },
]
[T] TIME: 2024-08-14T08:53:17.618354 DatabaseAccessor.insert [end] => [future] >> 1
[T] TIME: 2024-08-14T08:53:17.624580 DatabaseAccessor.insert [start] :: [
  mems,
  {
    name: Memo detail scenario - mem name: Save: Archive: inserted - unarchived,
    createdAt: 2024-08-14 08:53:17.624216,
  },
]
[T] TIME: 2024-08-14T08:53:17.727638 DatabaseAccessor.insert [end] => [future] >> 2
[T] TIME: 2024-08-14T08:53:17.737302 DatabaseAccessor.insert [start] :: [
  mem_items,
  {
    mems_id: 2,
    type: memo,
    value: Memo detail scenario - mem memo - inserted,
    createdAt: 0000-01-01 00:00:00.000,
  },
]
[T] TIME: 2024-08-14T08:53:17.852775 DatabaseAccessor.insert [end] => [future] >> 2
[T] TIME: 2024-08-14T08:53:17.857591 DatabaseAccessor.insert [start] :: [
  mems,
  {
    name: Memo detail scenario - mem name: Save: Archive: inserted - archived,
    createdAt: 2024-08-14 08:53:17.857201,
    archivedAt: 2024-08-14 08:53:17.857281,
  },
]
[T] TIME: 2024-08-14T08:53:17.951292 DatabaseAccessor.insert [end] => [future] >> 3
[T] TIME: 2024-08-14T08:53:17.951804 DatabaseAccessor.insert [start] :: [
  mem_items,
  {
    mems_id: 3,
    type: memo,
    value: Memo detail scenario - mem memo - inserted,
    createdAt: 0000-01-01 00:00:00.000,
  },
]
[T] TIME: 2024-08-14T08:53:18.023744 DatabaseAccessor.insert [end] => [future] >> 3
[I] TIME: 2024-08-14T08:53:18.087127 main [start] :: {
  languageCode: en,
}
[T] TIME: 2024-08-14T08:53:18.104074 new NotificationRepository [start] :: {
  _instance: Instance of 'NotificationRepository',
}
[T] TIME: 2024-08-14T08:53:18.118851 new NotificationRepository [end] => Instance of 'NotificationRepository'
[T] TIME: 2024-08-14T08:53:18.130343 NotificationRepository.checkNotification [start] :: null
[T] TIME: 2024-08-14T08:53:18.143021 FlutterLocalNotificationsWrapper.handleAppLaunchDetails [start] :: null
[T] TIME: 2024-08-14T08:53:18.147055 FlutterLocalNotificationsWrapper._flutterLocalNotificationsPlugin [start] :: {
  _pluginIsInitializing: true,
}
[T] TIME: 2024-08-14T08:53:18.149317 FlutterLocalNotificationsWrapper._flutterLocalNotificationsPlugin [end] => [future] >> Instance of 'FlutterLocalNotificationsPlugin'
[T] TIME: 2024-08-14T08:53:18.151570 FlutterLocalNotificationsWrapper.handleAppLaunchDetails [end] => [future] >> false
[T] TIME: 2024-08-14T08:53:18.171986 NotificationRepository.checkNotification [end] => [future] >> false
[I] TIME: 2024-08-14T08:53:18.176160 _runApplication [start] :: {
  languageCode: en,
  initialPath: null,
}
[I] TIME: 2024-08-14T08:53:18.188739 _runApplication [end] => [future] >> null
[I] TIME: 2024-08-14T08:53:18.193316 main [end] => [future] >> null
[T] TIME: 2024-08-14T08:53:21.999538 ValueStateNotifier.updatedBy [start] :: {
  current: false,
  updating: true,
}
[T] TIME: 2024-08-14T08:53:22.001477 ValueStateNotifier.updatedBy [end] => true
[T] TIME: 2024-08-14T08:53:25.154370 showMemDetailPage [start] :: [
  MemListBody(state: _ConsumerState#afe93),
  MemListBody(state: _ConsumerState#afe93),
  3,
]
[T] TIME: 2024-08-14T08:53:25.155854 showMemDetailPage [end] => null
[T] TIME: 2024-08-14T08:53:29.400975 unarchiveMem.<anonymous closure> [start] :: {
  memId: 3,
}
[T] TIME: 2024-08-14T08:53:29.408136 MemClient.unarchive [start] :: {
  mem: Instance of 'SavedMemV1': {name: Memo detail scenario - mem name: Save: Archive: inserted - archived, doneAt: null, period: null}{id: 3, createdAt: 2024-08-14 08:53:17.857201, updatedAt: null, archivedAt: 2024-08-14 08:53:17.857281},
}
[I] TIME: 2024-08-14T08:53:29.411807 MemService.unarchive [start] :: Instance of 'SavedMemV1': {name: Memo detail scenario - mem name: Save: Archive: inserted - archived, doneAt: null, period: null}{id: 3, createdAt: 2024-08-14 08:53:17.857201, updatedAt: null, archivedAt: 2024-08-14 08:53:17.857281}
[T] TIME: 2024-08-14T08:53:29.467034 DatabaseTupleRepository.unarchive [start] :: {
  savedEntity: Instance of 'SavedMemEntity': {name: Memo detail scenario - mem name: Save: Archive: inserted - archived, doneAt: null, notifyOn: null, notifyAt: null, endOn: null, endAt: null, id: 3, createdAt: 2024-08-14 08:53:17.857201, updatedAt: null, archivedAt: 2024-08-14 08:53:17.857281},
  updatedAt: null,
}
[T] TIME: 2024-08-14T08:53:29.484946 DatabaseAccessor.update [start] :: [
  mems,
  {
    name: Memo detail scenario - mem name: Save: Archive: inserted - archived,
    doneAt: null,
    notifyOn: null,
    notifyAt: null,
    endOn: null,
    endAt: null,
    id: 3,
    createdAt: 2024-08-14 08:53:17.857201,
    updatedAt: 2024-08-14 08:53:29.480664,
    archivedAt: null,
  },
  id = ?,
  [
    3,
  ],
]
[T] TIME: 2024-08-14T08:53:29.657308 DatabaseAccessor.update [end] => [future] >> 1
[T] TIME: 2024-08-14T08:53:29.660652 DatabaseTupleRepository.unarchive [end] => [future] >> Instance of 'SavedMemEntity': {name: Memo detail scenario - mem name: Save: Archive: inserted - archived, doneAt: null, notifyOn: null, notifyAt: null, endOn: null, endAt: null, id: 3, createdAt: 2024-08-14 08:53:17.857201, updatedAt: 2024-08-14 08:53:29.480664, archivedAt: null}
[T] TIME: 2024-08-14T08:53:29.663627 MemItemRepository.unarchiveBy [start] :: {
  memId: 3,
  updatedAt: null,
}
[T] TIME: 2024-08-14T08:53:29.666172 MemItemRepository.ship [start] :: {
  memId: null,
  condition: mems_id = 3,
  groupBy: null,
  orderBy: null,
  offset: null,
  limit: null,
}
[T] TIME: 2024-08-14T08:53:29.668156 DatabaseTupleRepository.ship [start] :: {
  condition: mems_id = 3,
  groupBy: null,
  orderBy: null,
  offset: null,
  limit: null,
}
[T] TIME: 2024-08-14T08:53:29.704323 DatabaseAccessor.select [start] :: [
  mem_items,
  ( ( mems_id = ? ) ),
  [
    3,
  ],
  null,
  null,
]
[T] TIME: 2024-08-14T08:53:29.746233 DatabaseAccessor.select [end] => [future] >> [
  {
    type: memo,
    value: Memo detail scenario - mem memo - inserted,
    mems_id: 3,
    id: 3,
    createdAt: 0000-01-01 00:00:00.000,
    updatedAt: null,
    archivedAt: null,
  },
]
[T] TIME: 2024-08-14T08:53:29.752590 DatabaseTupleRepository.ship [end] => [future] >> [
  Instance of 'SavedMemItemEntity': {mems_id: 3, type: memo, value: Memo detail scenario - mem memo - inserted, id: 3, createdAt: 0000-01-01 00:00:00.000, updatedAt: null, archivedAt: null},
]
[T] TIME: 2024-08-14T08:53:29.761482 MemItemRepository.ship [end] => [future] >> [
  Instance of 'SavedMemItemEntity': {mems_id: 3, type: memo, value: Memo detail scenario - mem memo - inserted, id: 3, createdAt: 0000-01-01 00:00:00.000, updatedAt: null, archivedAt: null},
]
[T] TIME: 2024-08-14T08:53:29.769866 DatabaseTupleRepository.unarchive [start] :: {
  savedEntity: Instance of 'SavedMemItemEntity': {mems_id: 3, type: memo, value: Memo detail scenario - mem memo - inserted, id: 3, createdAt: 0000-01-01 00:00:00.000, updatedAt: null, archivedAt: null},
  updatedAt: null,
}
[T] TIME: 2024-08-14T08:53:29.797303 DatabaseAccessor.update [start] :: [
  mem_items,
  {
    mems_id: 3,
    type: memo,
    value: Memo detail scenario - mem memo - inserted,
    id: 3,
    createdAt: 0000-01-01 00:00:00.000,
    updatedAt: 2024-08-14 08:53:29.771726,
    archivedAt: null,
  },
  id = ?,
  [
    3,
  ],
]
[T] TIME: 2024-08-14T08:53:30.204871 DatabaseAccessor.update [end] => [future] >> 1
[T] TIME: 2024-08-14T08:53:30.211267 DatabaseTupleRepository.unarchive [end] => [future] >> Instance of 'SavedMemItemEntity': {mems_id: 3, type: memo, value: Memo detail scenario - mem memo - inserted, id: 3, createdAt: 0000-01-01 00:00:00.000, updatedAt: 2024-08-14 08:53:29.771726, archivedAt: null}
[T] TIME: 2024-08-14T08:53:30.218868 MemItemRepository.unarchiveBy [end] => [future] >> [
  Instance of 'SavedMemItemEntity': {mems_id: 3, type: memo, value: Memo detail scenario - mem memo - inserted, id: 3, createdAt: 0000-01-01 00:00:00.000, updatedAt: 2024-08-14 08:53:29.771726, archivedAt: null},
]
[T] TIME: 2024-08-14T08:53:30.222651 MemNotificationRepository.unarchiveBy [start] :: {
  memId: 3,
  condition: null,
  updatedAt: null,
}
[T] TIME: 2024-08-14T08:53:30.239524 MemNotificationRepository.ship [start] :: {
  memId: 3,
  memIdsIn: null,
  condition: null,
  groupBy: null,
  orderBy: null,
  offset: null,
  limit: null,
}
[T] TIME: 2024-08-14T08:53:30.269672 DatabaseTupleRepository.ship [start] :: {
  condition: mems_id = 3,
  groupBy: null,
  orderBy: null,
  offset: null,
  limit: null,
}
[T] TIME: 2024-08-14T08:53:30.290604 DatabaseAccessor.select [start] :: [
  mem_repeated_notifications,
  ( mems_id = ? ),
  [
    3,
  ],
  null,
  null,
]
[T] TIME: 2024-08-14T08:53:30.549944 DatabaseAccessor.select [end] => [future] >> []
[T] TIME: 2024-08-14T08:53:30.550419 DatabaseTupleRepository.ship [end] => [future] >> []
[T] TIME: 2024-08-14T08:53:30.550804 MemNotificationRepository.ship [end] => [future] >> []
[T] TIME: 2024-08-14T08:53:30.609197 MemNotificationRepository.unarchiveBy [end] => [future] >> []
[I] TIME: 2024-08-14T08:53:30.627752 MemService.unarchive [end] => [future] >> {mem: Instance of 'SavedMemV1': {name: Memo detail scenario - mem name: Save: Archive: inserted - archived, doneAt: null, period: null}{id: 3, createdAt: 2024-08-14 08:53:17.857201, updatedAt: 2024-08-14 08:53:29.480664, archivedAt: null}, memItems: [Instance of 'SavedMemItem': {memId: 3, type: MemItemType.memo, value: Memo detail scenario - mem memo - inserted}{id: 3, createdAt: 0000-01-01 00:00:00.000, updatedAt: 2024-08-14 08:53:29.771726, archivedAt: null}], notifications: []}
[T] TIME: 2024-08-14T08:53:30.630093 NotificationClient.registerMemNotifications [start] :: {
  memId: 3,
  savedMem: Instance of 'SavedMemV1': {name: Memo detail scenario - mem name: Save: Archive: inserted - archived, doneAt: null, period: null}{id: 3, createdAt: 2024-08-14 08:53:17.857201, updatedAt: 2024-08-14 08:53:29.480664, archivedAt: null},
  savedMemNotifications: [],
}
[T] TIME: 2024-08-14T08:53:30.632267 ActRepository.ship [start] :: {
  memId: 3,
  memIds: null,
  period: null,
  latestByMemIds: true,
  isActive: null,
  condition: null,
  groupBy: null,
  actOrderBy: null,
  orderBy: null,
  offset: null,
  limit: null,
}
[T] TIME: 2024-08-14T08:53:30.645314 DatabaseTupleRepository.ship [start] :: {
  condition: mems_id = 3,
  groupBy: Instance of 'GroupBy',
  orderBy: [],
  offset: null,
  limit: null,
}
[T] TIME: 2024-08-14T08:53:30.648021 MemClient.unarchive [end] => [future] >> {mem: Instance of 'SavedMemV1': {name: Memo detail scenario - mem name: Save: Archive: inserted - archived, doneAt: null, period: null}{id: 3, createdAt: 2024-08-14 08:53:17.857201, updatedAt: 2024-08-14 08:53:29.480664, archivedAt: null}, memItems: [Instance of 'SavedMemItem': {memId: 3, type: MemItemType.memo, value: Memo detail scenario - mem memo - inserted}{id: 3, createdAt: 0000-01-01 00:00:00.000, updatedAt: 2024-08-14 08:53:29.771726, archivedAt: null}], notifications: []}
[T] TIME: 2024-08-14T08:53:30.692791 ValueStateNotifier.updatedBy [start] :: {
  current: Instance of 'SavedMemV1': {name: Memo detail scenario - mem name: Save: Archive: inserted - archived, doneAt: null, period: null}{id: 3, createdAt: 2024-08-14 08:53:17.857201, updatedAt: null, archivedAt: 2024-08-14 08:53:17.857281},
  updating: Instance of 'SavedMemV1': {name: Memo detail scenario - mem name: Save: Archive: inserted - archived, doneAt: null, period: null}{id: 3, createdAt: 2024-08-14 08:53:17.857201, updatedAt: 2024-08-14 08:53:29.480664, archivedAt: null},
}
[T] TIME: 2024-08-14T08:53:30.695667 ValueStateNotifier.updatedBy [end] => Instance of 'SavedMemV1': {name: Memo detail scenario - mem name: Save: Archive: inserted - archived, doneAt: null, period: null}{id: 3, createdAt: 2024-08-14 08:53:17.857201, updatedAt: 2024-08-14 08:53:29.480664, archivedAt: null}
[T] TIME: 2024-08-14T08:53:30.731757 ListValueStateNotifier.upsertAll [start] :: {
  updatingItems: [
    Instance of 'SavedMemV1': {name: Memo detail scenario - mem name: Save: Archive: inserted - archived, doneAt: null, period: null}{id: 3, createdAt: 2024-08-14 08:53:17.857201, updatedAt: 2024-08-14 08:53:29.480664, archivedAt: null},
  ],
}
[T] TIME: 2024-08-14T08:53:30.753938 ValueStateNotifier.updatedBy [start] :: {
  current: [
    Instance of 'SavedMemV1': {name: Memo detail scenario - mem name - inserted, doneAt: null, period: null}{id: 1, createdAt: 0000-01-01 00:00:00.000, updatedAt: null, archivedAt: null},
    Instance of 'SavedMemV1': {name: Memo detail scenario - mem name: Save: Archive: inserted - unarchived, doneAt: null, period: null}{id: 2, createdAt: 2024-08-14 08:53:17.624216, updatedAt: null, archivedAt: null},
    Instance of 'SavedMemV1': {name: Memo detail scenario - mem name: Save: Archive: inserted - archived, doneAt: null, period: null}{id: 3, createdAt: 2024-08-14 08:53:17.857201, updatedAt: null, archivedAt: 2024-08-14 08:53:17.857281},
  ],
  updating: [
    Instance of 'SavedMemV1': {name: Memo detail scenario - mem name - inserted, doneAt: null, period: null}{id: 1, createdAt: 0000-01-01 00:00:00.000, updatedAt: null, archivedAt: null},
    Instance of 'SavedMemV1': {name: Memo detail scenario - mem name: Save: Archive: inserted - unarchived, doneAt: null, period: null}{id: 2, createdAt: 2024-08-14 08:53:17.624216, updatedAt: null, archivedAt: null},
    Instance of 'SavedMemV1': {name: Memo detail scenario - mem name: Save: Archive: inserted - archived, doneAt: null, period: null}{id: 3, createdAt: 2024-08-14 08:53:17.857201, updatedAt: 2024-08-14 08:53:29.480664, archivedAt: null},
  ],
}
[T] TIME: 2024-08-14T08:53:30.757887 ValueStateNotifier.updatedBy [end] => [
  Instance of 'SavedMemV1': {name: Memo detail scenario - mem name - inserted, doneAt: null, period: null}{id: 1, createdAt: 0000-01-01 00:00:00.000, updatedAt: null, archivedAt: null},
  Instance of 'SavedMemV1': {name: Memo detail scenario - mem name: Save: Archive: inserted - unarchived, doneAt: null, period: null}{id: 2, createdAt: 2024-08-14 08:53:17.624216, updatedAt: null, archivedAt: null},
  Instance of 'SavedMemV1': {name: Memo detail scenario - mem name: Save: Archive: inserted - archived, doneAt: null, period: null}{id: 3, createdAt: 2024-08-14 08:53:17.857201, updatedAt: 2024-08-14 08:53:29.480664, archivedAt: null},
]
[T] TIME: 2024-08-14T08:53:30.759921 ListValueStateNotifier.upsertAll [end] => [
  Instance of 'SavedMemV1': {name: Memo detail scenario - mem name - inserted, doneAt: null, period: null}{id: 1, createdAt: 0000-01-01 00:00:00.000, updatedAt: null, archivedAt: null},
  Instance of 'SavedMemV1': {name: Memo detail scenario - mem name: Save: Archive: inserted - unarchived, doneAt: null, period: null}{id: 2, createdAt: 2024-08-14 08:53:17.624216, updatedAt: null, archivedAt: null},
  Instance of 'SavedMemV1': {name: Memo detail scenario - mem name: Save: Archive: inserted - archived, doneAt: null, period: null}{id: 3, createdAt: 2024-08-14 08:53:17.857201, updatedAt: 2024-08-14 08:53:29.480664, archivedAt: null},
]
[T] TIME: 2024-08-14T08:53:30.762214 unarchiveMem.<anonymous closure> [end] => [future] >> {mem: Instance of 'SavedMemV1': {name: Memo detail scenario - mem name: Save: Archive: inserted - archived, doneAt: null, period: null}{id: 3, createdAt: 2024-08-14 08:53:17.857201, updatedAt: 2024-08-14 08:53:29.480664, archivedAt: null}, memItems: [Instance of 'SavedMemItem': {memId: 3, type: MemItemType.memo, value: Memo detail scenario - mem memo - inserted}{id: 3, createdAt: 0000-01-01 00:00:00.000, updatedAt: 2024-08-14 08:53:29.771726, archivedAt: null}], notifications: []}
[T] TIME: 2024-08-14T08:53:30.786131 DatabaseAccessor.select [start] :: [
  acts,
  ( mems_id = ? ),
  [
    3,
  ],
  null,
  null,
]
[T] TIME: 2024-08-14T08:53:30.828359 DatabaseAccessor.select [end] => [future] >> []
[T] TIME: 2024-08-14T08:53:30.828805 DatabaseTupleRepository.ship [end] => [future] >> []
[T] TIME: 2024-08-14T08:53:30.829186 ActRepository.ship [end] => [future] >> []
[T] TIME: 2024-08-14T08:53:30.829619 PreferenceClient.shipByKey [start] :: start_of_day
[T] TIME: 2024-08-14T08:53:30.830150 TimeOfDayPreferenceKey.deserialize [start] :: {
  serialized: null,
}
[T] TIME: 2024-08-14T08:53:30.830529 TimeOfDayPreferenceKey.deserialize [end] => null
[T] TIME: 2024-08-14T08:53:30.858952 PreferenceClient.shipByKey [end] => [future] >> {key: start_of_day, value: null}
[T] TIME: 2024-08-14T08:53:30.860730 MemV1.periodSchedules [start] :: {
  this: Instance of 'SavedMemV1': {name: Memo detail scenario - mem name: Save: Archive: inserted - archived, doneAt: null, period: null}{id: 3, createdAt: 2024-08-14 08:53:17.857201, updatedAt: 2024-08-14 08:53:29.480664, archivedAt: null},
  startOfDay: TimeOfDay(00:00),
}
[T] TIME: 2024-08-14T08:53:30.862383 new Schedule.of [start] :: {
  id: 3,
  at: null,
  notificationType: NotificationType.startMem,
}
[T] TIME: 2024-08-14T08:53:30.864026 NotificationChannelBuilder.buildNotificationId [start] :: {
  this: NotificationType.startMem,
  memId: 3,
}
[T] TIME: 2024-08-14T08:53:30.900912 NotificationChannelBuilder.buildNotificationId [end] => 31
[T] TIME: 2024-08-14T08:53:30.906063 new Schedule.of [end] => Instance of 'CancelSchedule': {id: 31}
[T] TIME: 2024-08-14T08:53:30.908105 new Schedule.of [start] :: {
  id: 3,
  at: null,
  notificationType: NotificationType.endMem,
}
[T] TIME: 2024-08-14T08:53:30.910104 NotificationChannelBuilder.buildNotificationId [start] :: {
  this: NotificationType.endMem,
  memId: 3,
}
[T] TIME: 2024-08-14T08:53:30.912048 NotificationChannelBuilder.buildNotificationId [end] => 32
[T] TIME: 2024-08-14T08:53:30.914018 new Schedule.of [end] => Instance of 'CancelSchedule': {id: 32}
[T] TIME: 2024-08-14T08:53:30.915964 MemV1.periodSchedules [end] => [
  Instance of 'CancelSchedule': {id: 31},
  Instance of 'CancelSchedule': {id: 32},
]
[T] TIME: 2024-08-14T08:53:30.918035 MemNotifications.periodicScheduleOf [start] :: {
  savedMem: Instance of 'SavedMemV1': {name: Memo detail scenario - mem name: Save: Archive: inserted - archived, doneAt: null, period: null}{id: 3, createdAt: 2024-08-14 08:53:17.857201, updatedAt: 2024-08-14 08:53:29.480664, archivedAt: null},
  startOfDay: TimeOfDay(00:00),
  memNotifications: [],
  latestAct: null,
  now: 2024-08-14 08:53:30.917718,
}
[T] TIME: 2024-08-14T08:53:30.920034 MemNotifications.periodicScheduleOf [end] => Instance of 'CancelSchedule': {id: 33}
[T] TIME: 2024-08-14T08:53:30.957485 ScheduleClient.receive [start] :: {
  entity: Instance of 'CancelSchedule': {id: 31},
}
[T] TIME: 2024-08-14T08:53:30.965541 PermissionHandlerWrapper.grant [start] :: {
  permission: Permission.notification,
}
[T] TIME: 2024-08-14T08:53:30.975729 PermissionHandlerWrapper.grant [end] => [future] >> true
[T] TIME: 2024-08-14T08:53:30.983668 ScheduleClient.discard [start] :: {
  id: 31,
}
[T] TIME: 2024-08-14T08:53:30.985740 AndroidAlarmManagerWrapper.cancel [start] :: {
  id: 31,
}
[T] TIME: 2024-08-14T08:53:30.999227 AndroidAlarmManagerWrapper._initialize [start] :: {
  _initialized: true,
  defaultTargetPlatform: TargetPlatform.android,
}
[T] TIME: 2024-08-14T08:53:31.001488 AndroidAlarmManagerWrapper._initialize [end] => [future] >> true
[T] TIME: 2024-08-14T08:53:31.015141 AndroidAlarmManagerWrapper.cancel [end] => [future] >> true
[T] TIME: 2024-08-14T08:53:31.017368 ScheduleClient.discard [end] => [future] >> true
[T] TIME: 2024-08-14T08:53:31.019387 ScheduleClient.receive [end] => [future] >> null
[T] TIME: 2024-08-14T08:53:31.042433 ScheduleClient.receive [start] :: {
  entity: Instance of 'CancelSchedule': {id: 32},
}
[T] TIME: 2024-08-14T08:53:31.052123 PermissionHandlerWrapper.grant [start] :: {
  permission: Permission.notification,
}
[T] TIME: 2024-08-14T08:53:31.067255 PermissionHandlerWrapper.grant [end] => [future] >> true
[T] TIME: 2024-08-14T08:53:31.069993 ScheduleClient.discard [start] :: {
  id: 32,
}
[T] TIME: 2024-08-14T08:53:31.097475 AndroidAlarmManagerWrapper.cancel [start] :: {
  id: 32,
}
[T] TIME: 2024-08-14T08:53:31.112939 AndroidAlarmManagerWrapper._initialize [start] :: {
  _initialized: true,
  defaultTargetPlatform: TargetPlatform.android,
}
[T] TIME: 2024-08-14T08:53:31.128144 AndroidAlarmManagerWrapper._initialize [end] => [future] >> true
[T] TIME: 2024-08-14T08:53:33.664407 AndroidAlarmManagerWrapper.cancel [end] => [future] >> true
[T] TIME: 2024-08-14T08:53:33.669666 ScheduleClient.discard [end] => [future] >> true
[T] TIME: 2024-08-14T08:53:33.672064 ScheduleClient.receive [end] => [future] >> null
[T] TIME: 2024-08-14T08:53:33.674266 ScheduleClient.receive [start] :: {
  entity: Instance of 'CancelSchedule': {id: 33},
}
[T] TIME: 2024-08-14T08:53:33.676251 PermissionHandlerWrapper.grant [start] :: {
  permission: Permission.notification,
}
[T] TIME: 2024-08-14T08:53:33.678584 PermissionHandlerWrapper.grant [end] => [future] >> true
[T] TIME: 2024-08-14T08:53:33.680537 ScheduleClient.discard [start] :: {
  id: 33,
}
[T] TIME: 2024-08-14T08:53:33.730984 AndroidAlarmManagerWrapper.cancel [start] :: {
  id: 33,
}
[T] TIME: 2024-08-14T08:53:33.733066 AndroidAlarmManagerWrapper._initialize [start] :: {
  _initialized: true,
  defaultTargetPlatform: TargetPlatform.android,
}
[T] TIME: 2024-08-14T08:53:33.735262 AndroidAlarmManagerWrapper._initialize [end] => [future] >> true
[T] TIME: 2024-08-14T08:53:34.068588 AndroidAlarmManagerWrapper.cancel [end] => [future] >> true
[T] TIME: 2024-08-14T08:53:34.099267 ScheduleClient.discard [end] => [future] >> true
[T] TIME: 2024-08-14T08:53:34.103692 ScheduleClient.receive [end] => [future] >> null
[T] TIME: 2024-08-14T08:53:34.193132 NotificationClient.registerMemNotifications [end] => [future] >> null
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following TestFailure was thrown running a test:
Expected: exactly one matching candidate
  Actual: _TextWidgetFinder:<Found 0 widgets with text "Unarchive success. Memo detail scenario -
mem name: Save: Archive: inserted - archived": []>
   Which: means none were found but one was expected

When the exception was thrown, this was the stack:
#4      main.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure> (file:///Users/runner/work/mem/mem/integration_test/scenarios/memo/detail_scenarios.dart:299:17)
<asynchronous suspension>
#5      testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:189:15)
<asynchronous suspension>
#6      TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:1032:5)
<asynchronous suspension>
<asynchronous suspension>
(elided one frame from package:stack_trace)

This was caught by the test expectation on the following line:
  file:///Users/runner/work/mem/mem/integration_test/scenarios/memo/detail_scenarios.dart line 299
The test description was:
  : unarchive.
════════════════════════════════════════════════════════════════════════════════════════════════════
find.text(l10n.unarchiveMemSuccessMessage(archivedMemName)),
findsOneWidget,
);
findsOneWidget);

final findArchivedMem =
Equals(defColMemsName, archivedMemName);
final mems = await dbA.select(
defTableMems,
final findArchivedMem = Equals(defColMemsName, archivedMemName);
final mems = await dbA.select(defTableMems,
where: findArchivedMem.where(),
whereArgs: findArchivedMem.whereArgs(),
);
expect(mems.length, 1);
expect(mems.single[defColArchivedAt.name], isNull);
},
);
whereArgs: findArchivedMem.whereArgs());
expect(mems.length, 1);
expect(mems.single[defColArchivedAt.name], isNull);
});
});
},
);
Expand Down
7 changes: 0 additions & 7 deletions lib/framework/repository/database_tuple_entity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ mixin SavedDatabaseTupleMixinV1<T> on EntityV1 {

bool get isArchived => archivedAt != null;

void pack(Map<String, dynamic> tuple) {
id = tuple[defPkId.name];
createdAt = tuple[defColCreatedAt.name];
updatedAt = tuple[defColUpdatedAt.name];
archivedAt = tuple[defColArchivedAt.name];
}

Map<String, dynamic> unpack() {
return {
defPkId.name: id,
Expand Down
28 changes: 22 additions & 6 deletions test/act_counter/act_counter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,25 @@ import 'package:mem/core/date_and_time/date_and_time_period.dart';
import 'package:mem/repositories/mem.dart';

void main() {
test(
": constructor.",
() {
group('ActCounter.from', () {
test(": updatedAt is last act start.", () {
const memId = 1;
final zeroDate = DateTime(0);
final oneDate = DateTime(1);

final savedMem = SavedMemV1("constructor", null, null)..id = memId;
final acts = [
SavedAct(memId, DateAndTimePeriod.startNow())
..createdAt = zeroDate
..updatedAt = oneDate,
SavedAct(memId, DateAndTimePeriod.startNow())..createdAt = zeroDate
];

final actCounter = ActCounter.from(savedMem, acts);

expect(actCounter.updatedAt, equals(acts[0].period.start));
});
test(": updatedAt is last act end.", () {
const memId = 1;
final zeroDate = DateTime(0);
final oneDate = DateTime(1);
Expand All @@ -18,14 +34,14 @@ void main() {
SavedAct(memId, DateAndTimePeriod(end: DateAndTime.now()))
..createdAt = zeroDate
..updatedAt = oneDate,
SavedAct(memId, DateAndTimePeriod.startNow())..createdAt = zeroDate,
SavedAct(memId, DateAndTimePeriod.startNow())..createdAt = zeroDate
];

final actCounter = ActCounter.from(savedMem, acts);

expect(actCounter.updatedAt, equals(acts[0].period.end));
},
);
});
});

group('period', () {
test(': startDate time is 5:00', () {
Expand Down

0 comments on commit fd828de

Please sign in to comment.