• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

asartalo / diligence / 8476139677

29 Mar 2024 01:53AM UTC coverage: 92.831%. First build
8476139677

Pull #34

github

asartalo
ci: update workflows for new branch structure
Pull Request #34: diligent implementation using sqlite3 and MVP features

1046 of 1126 new or added lines in 56 files covered. (92.9%)

1282 of 1381 relevant lines covered (92.83%)

2.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/lib/services/diligent/command_handler.dart
1
// Diligence - A Task Management App
2
//
3
// Copyright (C) 2024 Wayne Duran <asartalo@gmail.com>
4
//
5
// This program is free software: you can redistribute it and/or modify it under
6
// the terms of the GNU General Public License as published by the Free Software
7
// Foundation, either version 3 of the License, or (at your option) any later
8
// version.
9
//
10
// This program is distributed in the hope that it will be useful, but WITHOUT
11
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License along with
15
// this program. If not, see <https://www.gnu.org/licenses/>.
16

17
import '../../models/commands/commands.dart';
18
import '../diligent.dart';
19

20
typedef BaseCommandHandler = Future<CommandResult> Function(
21
  Diligent diligent,
22
  Command command,
23
);
24

25
typedef CommandHandler<T extends Command> = Future<CommandResult> Function(
26
  Diligent diligent,
27
  T command,
28
);
29

30
BaseCommandHandler wrapHandler<T extends Command>(
2✔
31
  CommandHandler<T> handler,
32
) {
33
  return (Diligent diligent, Command command) {
2✔
34
    if (command is T) {
2✔
35
      return handler(diligent, command);
2✔
36
    }
37

38
    // Expecting this never happens
NEW
39
    return Future.value(
×
NEW
40
      Fail(message: 'Expected instance of $T but got: ${command.runtimeType}'),
×
41
    );
42
  };
43
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc