Skip to content

Commit bb06313

Browse files
committed
Fix tests
1 parent 6db9d1b commit bb06313

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

lib/logger/app_logger.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import 'package:logger/logger.dart';
55
final logger = Logger(
66
level: Level.all,
77
filter: ProductionFilter(),
8-
printer: PrettyPrinter(
8+
printer: stdout.hasTerminal ? PrettyPrinter(
99
methodCount: 0,
1010
excludeBox: {
1111
Level.trace: true
1212
},
1313
colors: stdout.supportsAnsiEscapes,
1414
lineLength: stdout.terminalColumns,
15-
),
15+
) : SimplePrinter(),
1616
);

test/services/repo_service_test.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,18 @@ void main() {
3535
// arrange
3636
final path = "/path/to/folder";
3737
final branch = "selected_branch";
38-
final branches = ['', branch];
38+
bool firstExec = true;
3939

4040
when(() => mockAppConfig.gitRepoPath).thenReturn(path);
4141
when(() => mockAppConfig.gitBranch).thenAnswer(
42-
(_) => isBranchDefined ? branch : branches.removeAt(0),
42+
(_) {
43+
if (isBranchDefined) return branch;
44+
if (firstExec) {
45+
firstExec = false;
46+
return '';
47+
}
48+
return branch;
49+
},
4350
);
4451
when(() => mockAppConfig.gitForceRemote).thenReturn(gitForceRemote);
4552
when(() => mockAppConfig.gitSSLEnabled).thenReturn(true);

0 commit comments

Comments
 (0)