cover the cli-install env fallback and stale-GUI activation paths
Adds the two missing cases that left lib/kernel/src/cli_install.dart:74 (default-environment constructor branch) and the builtin extension's stale-GUI activation warning uncovered. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -69,6 +69,22 @@ void main() {
|
|||||||
expect(notes.first.title, 'clide CLI not installed');
|
expect(notes.first.title, 'clide CLI not installed');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('warns on activation when clide is a stale GUI symlink', () async {
|
||||||
|
final gui = touchExec('${tmp.path}/gui/clide').path;
|
||||||
|
final binDir = Directory('${tmp.path}/bin')..createSync();
|
||||||
|
Link('${binDir.path}/clide').createSync(gui); // PATH clide → the GUI
|
||||||
|
await boot(CliInstaller(
|
||||||
|
resolvedExecutable: gui,
|
||||||
|
env: {'PATH': binDir.path},
|
||||||
|
bundledClientCandidates: const [],
|
||||||
|
installDir: binDir.path,
|
||||||
|
));
|
||||||
|
final notes = f.services.notify.active;
|
||||||
|
expect(notes, isNotEmpty);
|
||||||
|
expect(notes.first.level, NotificationLevel.warning);
|
||||||
|
expect(notes.first.title, 'clide CLI is stale');
|
||||||
|
});
|
||||||
|
|
||||||
test('does not warn when clide is already installed', () async {
|
test('does not warn when clide is already installed', () async {
|
||||||
final binDir = Directory('${tmp.path}/bin')..createSync();
|
final binDir = Directory('${tmp.path}/bin')..createSync();
|
||||||
touchExec('${binDir.path}/clide');
|
touchExec('${binDir.path}/clide');
|
||||||
|
|||||||
@@ -128,6 +128,14 @@ void main() {
|
|||||||
);
|
);
|
||||||
expect(i.bundledClientCandidates, ['/opt/clide/bundle/clide-cli']);
|
expect(i.bundledClientCandidates, ['/opt/clide/bundle/clide-cli']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('falls back to the process environment when no env is passed', () {
|
||||||
|
// No env → uses Platform.environment; the in-bundle candidate still
|
||||||
|
// derives from the exe dir and the install dir from $HOME.
|
||||||
|
final i = CliInstaller(resolvedExecutable: '/opt/clide/bundle/clide');
|
||||||
|
expect(i.bundledClientCandidates, contains('/opt/clide/bundle/clide-cli'));
|
||||||
|
expect(i.installDir, endsWith('/.local/bin'));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
group('expandedPath', () {
|
group('expandedPath', () {
|
||||||
|
|||||||
Reference in New Issue
Block a user