testTaskStatus function

Future testTaskStatus()

Implementation

Future testTaskStatus() async {
  // uidB is the Assignee of the task
  final uidB = await loginAsB();

  // uidA is Creator of the task
  await loginAsA();

  // uidA created a task and assigned it to uidB
  final task = await createTask();
  final createdAssignRef = await Assign.create(uid: uidB, taskId: task.id);
  final createdAssign = await Assign.get(createdAssignRef.id);

  isTrue(createdAssign!.status == AssignStatus.waiting,
      'Expect: Assign status must be waiting.');

  // uidB change the status to progress
  await loginAsB();
  await createdAssign.changeStatus(AssignStatus.progress);
  final updatedAssignToProgress = await Assign.get(createdAssignRef.id);
  isTrue(updatedAssignToProgress!.status == AssignStatus.progress,
      'Expect: Success on task status change. Must be `progress`.');

  // uidA change the status to finished
  await loginAsA();
  await createdAssign.changeStatus(AssignStatus.finished);
  final updatedAssignToFinished = await Assign.get(createdAssignRef.id);
  isTrue(updatedAssignToFinished!.status == AssignStatus.finished,
      'Expect: success on task status change. Must be `finished`.');
}