Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/very_good_cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ on:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v5
Expand Down
30 changes: 29 additions & 1 deletion test/src/command_runner_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,10 @@ void main() {

stdout = _MockStdout();
when(() => stdout.hasTerminal).thenReturn(true);
when(() => stdout.supportsAnsiEscapes).thenReturn(true);

when(() => stdout.terminalColumns).thenReturn(30);

when(() => stdout.supportsAnsiEscapes).thenReturn(true);
});

test('shows message when version changed', () async {
Expand Down Expand Up @@ -269,6 +271,32 @@ void main() {
);
});

test('fallback to HOME when XDG_CONFIG_HOME is null/empty', () async {
commandRunner
..environmentOverride = {
'HOME': '/users/test',
'XDG_CONFIG_HOME': '',
}
..isWindowsOverride = false;

final homeCache = _MockDirectory();
when(() => homeCache.path).thenReturn('/users/test');

await IOOverrides.runZoned(
() async {
final result = await commandRunner.run([]);
expect(result, equals(ExitCode.success.code));

verifyNever(() => cliCache.path);
verify(() => homeCache.path).called(1);
},
createDirectory: (path) =>
path.contains('test') ? homeCache : cliCache,
createFile: (path) => versionFile,
stdout: () => stdout,
);
});

test('cache inside local APP_DATA on windows', () async {
commandRunner
..environmentOverride = {'LOCALAPPDATA': '/C/Users/test'}
Expand Down