Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

DesktopLinuxUrlHandler.test.ts

620 lines23.6 KB

1import * as NodeServices from "@effect/platform-node/NodeServices";
2import { assert, describe, it } from "@effect/vitest";
3import * as Deferred from "effect/Deferred";
4import * as Effect from "effect/Effect";
5import * as FileSystem from "effect/FileSystem";
6import * as Layer from "effect/Layer";
7import * as Option from "effect/Option";
8import * as Path from "effect/Path";
9import * as PlatformError from "effect/PlatformError";
10import * as Sink from "effect/Sink";
11import * as Stream from "effect/Stream";
12import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
13​
14import * as DesktopEnvironment from "./DesktopEnvironment.ts";
15import * as DesktopAssets from "./DesktopAssets.ts";
16import * as DesktopLinuxUrlHandler from "./DesktopLinuxUrlHandler.ts";
17​
18interface RecordedRegistration {
19 readonly directories: string[];
20 readonly files: Array<{ readonly path: string; readonly content: string }>;
21 readonly commands: Array<{ readonly command: string; readonly args: ReadonlyArray<string> }>;
22 readonly copies: Array<{ readonly source: string; readonly destination: string }>;
24​
25const makeEnvironment = (path: Path.Path, overrides: Record<string, unknown> = {}) =>
26 DesktopEnvironment.DesktopEnvironment.of({
27 platform: "linux",
28 isPackaged: true,
29 isDevelopment: false,
30 displayName: "T3 Code (Alpha)",
31 linuxDesktopEntryName: "com.t3tools.T3Code.desktop",
32 linuxWmClass: "t3code",
33 linuxApplicationsDir: "/home/alice/.local/share/applications",
34 desktopLauncherPath: Option.none(),
35 appImagePath: Option.some("/home/alice/Applications/T3-Code.AppImage"),
36 path,
37 ...overrides,
38 } as unknown as DesktopEnvironment.DesktopEnvironment["Service"]);
39​
40const mockProcess = (exitCode: number, stalled = false) =>
41 ChildProcessSpawner.makeHandle({
42 pid: ChildProcessSpawner.ProcessId(1),
43 exitCode: stalled ? Effect.never : Effect.succeed(ChildProcessSpawner.ExitCode(exitCode)),
44 isRunning: Effect.succeed(false),
45 kill: () => Effect.void,
46 unref: Effect.succeed(Effect.void),
47 stdin: Sink.drain,
48 stdout: Stream.empty,
49 stderr: Stream.empty,
50 all: Stream.empty,
51 getInputFd: () => Sink.drain,
52 getOutputFd: () => Stream.empty,
53 });
54​
55const layerHandler = (
56 recorded: RecordedRegistration,
57 input: {
58 readonly environment?: Record<string, unknown>;
59 readonly updateDesktopDatabaseExitCode?: number;
60 readonly updateDesktopDatabaseStalled?: boolean;
61 readonly updateDesktopDatabaseStarted?: Deferred.Deferred<void>;
62 readonly xdgMimeExitCode?: number;
63 readonly writeError?: PlatformError.PlatformError;
64 readonly existingEntry?: string;
65 readonly iconSource?: string;
66 readonly iconCopyError?: PlatformError.PlatformError;
67 } = {},
68) =>
69 DesktopLinuxUrlHandler.layer.pipe(
70 Layer.provide(
71 Layer.mergeAll(
72 Layer.effect(
73 DesktopEnvironment.DesktopEnvironment,
74 Path.Path.pipe(
75 Effect.map((path) => makeEnvironment(path, input.environment)),
76 Effect.provide(Path.layer),
77 ),
78 ),
79 Layer.succeed(DesktopAssets.DesktopAssets, {
80 iconPaths: Effect.succeed({
81 png: Option.fromUndefinedOr(input.iconSource),
82 ico: Option.none(),
83 icns: Option.none(),
84 }),
85 resolveResourcePath: () => Effect.succeedNone,
86 }),
87 FileSystem.layerNoop({
88 copyFile: (source, destination) =>
89 input.iconCopyError
90 ? Effect.fail(input.iconCopyError)
91 : Effect.sync(() => {
92 recorded.copies.push({ source, destination });
93 }),
94 readFileString: () => Effect.succeed(input.existingEntry ?? ""),
95 makeDirectory: (path) =>
96 Effect.sync(() => {
97 recorded.directories.push(path);
98 }),
99 writeFileString: (path, content) =>
100 input.writeError
101 ? Effect.fail(input.writeError)
102 : Effect.sync(() => {
103 recorded.files.push({ path, content });
104 }),
105 }),
106 Layer.succeed(
107 ChildProcessSpawner.ChildProcessSpawner,
108 ChildProcessSpawner.make((command) => {
109 const childProcess = command as unknown as {
110 readonly command: string;
111 readonly args: ReadonlyArray<string>;
112 };
113 if (childProcess.command === "update-desktop-database") {
114 assert.isTrue(
115 recorded.files.length > 0 || input.existingEntry !== undefined,
116 "the desktop entry must exist before refreshing the MIME cache",
117 );
118 }
119 recorded.commands.push({
120 command: childProcess.command,
121 args: childProcess.args,
122 });
123 const exitCode =
124 childProcess.command === "update-desktop-database"
125 ? (input.updateDesktopDatabaseExitCode ?? 0)
126 : (input.xdgMimeExitCode ?? 0);
127 const handle = mockProcess(
128 exitCode,
129 childProcess.command === "update-desktop-database" &&
130 input.updateDesktopDatabaseStalled === true,
131 );
132 return childProcess.command === "update-desktop-database" &&
133 input.updateDesktopDatabaseStarted
134 ? Deferred.succeed(input.updateDesktopDatabaseStarted, undefined).pipe(
135 Effect.as(handle),
136 )
137 : Effect.succeed(handle);
138 }),
139 ),
140 ),
141 ),
142 );
143​
144const runRegister = (
145 recorded: RecordedRegistration,
146 input: Parameters<typeof layerHandler>[1] = {},
147) =>
148 Effect.gen(function* () {
149 const handler = yield* DesktopLinuxUrlHandler.DesktopLinuxUrlHandler;
150 yield* handler.register;
151 }).pipe(Effect.provide(layerHandler(recorded, input)));
152​
153const emptyRecording = (): RecordedRegistration => ({
154 directories: [],
155 files: [],
156 commands: [],
157 copies: [],
158});
159​
160describe("DesktopLinuxUrlHandler", () => {
161 it("renders a scheme-handler desktop entry with freedesktop Exec quoting", () => {
162 const entry = DesktopLinuxUrlHandler.renderUrlHandlerDesktopEntry({
163 displayName: "T3 Code (Nightly)",
164 execTarget: '/home/al ice/Apps/T3 "100%" $HOME\\x.AppImage',
165 scheme: "t3code",
166 iconPath: "/home/al ice/icons/T3\\x.png",
167 });
168​
169 assert.include(entry, "[Desktop Entry]");
170 assert.include(entry, "Name=T3 Code (Nightly)");
171 assert.include(
172 entry,
173 'Exec="/home/al ice/Apps/T3 \\\\"100%%\\\\" \\\\$HOME\\\\\\\\x.AppImage" %U',
174 );
175 assert.include(entry, "NoDisplay=true");
176 assert.notInclude(entry, "StartupWMClass=");
177 assert.include(entry, "MimeType=x-scheme-handler/t3code;");
178 assert.include(entry, "Icon=/home/al ice/icons/T3\\\\x.png");
179 });
180​
181 it.effect(
182 "writes the handler entry, refreshes the MIME cache, and claims the scheme default",
183 () => {
184 const recorded = emptyRecording();
185​
186 return Effect.gen(function* () {
187 yield* runRegister(recorded);
188​
189 assert.deepEqual(recorded.directories, ["/home/alice/.local/share/applications"]);
190 assert.equal(recorded.files.length, 1);
191 assert.equal(
192 recorded.files[0]?.path,
193 "/home/alice/.local/share/applications/com.t3tools.T3Code.desktop",
194 );
195 assert.include(
196 recorded.files[0]?.content,
197 "Exec=/home/alice/Applications/T3-Code.AppImage %U",
198 );
199 assert.include(recorded.files[0]?.content, "MimeType=x-scheme-handler/t3code;");
200 assert.deepEqual(recorded.commands, [
201 {
202 command: "update-desktop-database",
203 args: ["/home/alice/.local/share/applications"],
204 },
205 {
206 command: "xdg-mime",
207 args: ["default", "com.t3tools.T3Code.desktop", "x-scheme-handler/t3code"],
208 },
209 ]);
210 });
211 },
212 );
213​
214 it.effect("falls back to the process executable outside an AppImage", () => {
215 const recorded = emptyRecording();
216​
217 return Effect.gen(function* () {
218 yield* runRegister(recorded, { environment: { appImagePath: Option.none() } });
219​
220 assert.include(
221 recorded.files[0]?.content,
222 DesktopLinuxUrlHandler.renderUrlHandlerDesktopEntry({
223 displayName: "T3 Code (Alpha)",
224 execTarget: process.execPath,
225 scheme: "t3code",
226 iconPath: "/home/alice/.local/share/icons/com.t3tools.T3Code.desktop.png",
227 }),
228 );
229 });
230 });
231​
232 it.effect("launches a distribution package through its configured launcher", () => {
233 const recorded = emptyRecording();
234​
235 return Effect.gen(function* () {
236 yield* runRegister(recorded, {
237 environment: { desktopLauncherPath: Option.some("/opt/T3 Code/t3code") },
238 });
239​
240 assert.include(recorded.files[0]?.content, 'Exec="/opt/T3 Code/t3code" %U');
241 });
242 });
243​
244 it.effect("does not rewrite the pre-ready entry while the portal can be reading it", () => {
245 const recorded = emptyRecording();
246​
247 return Effect.gen(function* () {
248 yield* runRegister(recorded, {
249 existingEntry: DesktopLinuxUrlHandler.renderUrlHandlerDesktopEntry({
250 displayName: "T3 Code (Alpha)",
251 execTarget: "/home/alice/Applications/T3-Code.AppImage",
252 scheme: "t3code",
253 iconPath: "/home/alice/.local/share/icons/com.t3tools.T3Code.desktop.png",
254 }),
255 });
256​
257 assert.deepEqual(recorded.files, []);
258 assert.deepEqual(recorded.directories, []);
259 assert.deepEqual(recorded.commands, [
260 {
261 command: "update-desktop-database",
262 args: ["/home/alice/.local/share/applications"],
263 },
264 {
265 command: "xdg-mime",
266 args: ["default", "com.t3tools.T3Code.desktop", "x-scheme-handler/t3code"],
267 },
268 ]);
269 });
270 });
271​
272 it.effect("installs a persistent icon even when the desktop entry is already current", () => {
273 const recorded = emptyRecording();
274 const iconPath = "/home/alice/.local/share/icons/com.t3tools.T3Code.desktop.png";
275 return Effect.gen(function* () {
276 yield* runRegister(recorded, {
277 iconSource: "/tmp/.mount_T3/resources/icon.png",
278 existingEntry: DesktopLinuxUrlHandler.renderUrlHandlerDesktopEntry({
279 displayName: "T3 Code (Alpha)",
280 execTarget: "/home/alice/Applications/T3-Code.AppImage",
281 scheme: "t3code",
282 iconPath,
283 }),
284 });
285 assert.deepEqual(recorded.files, []);
286 assert.deepEqual(recorded.copies, [
287 { source: "/tmp/.mount_T3/resources/icon.png", destination: iconPath },
288 ]);
289 assert.equal(recorded.commands.at(-1)?.command, "xdg-mime");
290 });
291 });
292​
293 it.effect("still registers the handler when copying its icon fails", () => {
294 const recorded = emptyRecording();
295 return Effect.gen(function* () {
296 yield* runRegister(recorded, {
297 iconSource: "/tmp/.mount_T3/resources/icon.png",
298 iconCopyError: PlatformError.systemError({
299 _tag: "PermissionDenied",
300 module: "FileSystem",
301 method: "copyFile",
302 description: "read-only icon directory",
303 }),
304 });
305 assert.equal(recorded.files.length, 1);
306 assert.deepEqual(
307 recorded.commands.map(({ command }) => command),
308 ["update-desktop-database", "xdg-mime"],
309 );
310 });
311 });
312​
313 it.effect("writes the portal identity without claiming the URL scheme in development", () => {
314 const nonLinux = emptyRecording();
315 const unpackaged = emptyRecording();
316​
317 return Effect.gen(function* () {
318 yield* runRegister(nonLinux, { environment: { platform: "darwin" } });
319 yield* runRegister(unpackaged, {
320 environment: {
321 isPackaged: false,
322 linuxDesktopEntryName: "com.t3tools.T3Code.Development.desktop",
323 },
324 });
325​
326 assert.deepEqual(nonLinux.files, []);
327 assert.equal(
328 unpackaged.files[0]?.path,
329 "/home/alice/.local/share/applications/com.t3tools.T3Code.Development.desktop",
330 );
331 assert.deepEqual(unpackaged.commands, []);
332 });
333 });
334​
335 it.effect("never fails startup when registration cannot complete", () => {
336 const desktopDatabaseFailed = emptyRecording();
337 const xdgMimeFailed = emptyRecording();
338 const writeFailed = emptyRecording();
339​
340 return Effect.gen(function* () {
341 yield* runRegister(desktopDatabaseFailed, { updateDesktopDatabaseExitCode: 1 });
342 yield* runRegister(xdgMimeFailed, { xdgMimeExitCode: 1 });
343 yield* runRegister(writeFailed, {
344 writeError: PlatformError.systemError({
345 _tag: "PermissionDenied",
346 module: "FileSystem",
347 method: "writeFileString",
348 description: "read-only filesystem",
349 pathOrDescriptor: "/home/alice/.local/share/applications/com.t3tools.T3Code.desktop",
350 }),
351 });
352​
353 assert.deepEqual(
354 desktopDatabaseFailed.commands.map(({ command }) => command),
355 ["update-desktop-database", "xdg-mime"],
356 );
357 assert.equal(xdgMimeFailed.files.length, 1);
358 assert.deepEqual(writeFailed.commands, []);
359 });
360 });
361});
362​
363interface ThemeIconRun {
364 readonly root: string;
365 readonly commands: Array<{ readonly command: string; readonly args: ReadonlyArray<string> }>;
366 readonly iconCacheOptions?: Array<Record<string, unknown>>;
367 readonly sourceMissing?: boolean;
368 readonly iconCacheExitCode?: number;
369 readonly iconCacheSpawnFails?: boolean;
370 readonly iconCacheStalled?: boolean;
371 readonly iconCacheStarted?: Deferred.Deferred<void>;
372 // Stands in for gtk-update-icon-cache rewriting the cache on success.
373 readonly onIconCacheRefresh?: Effect.Effect<void>;
375​
376const registerWithRealFileSystem = (run: ThemeIconRun) =>
377 Effect.gen(function* () {
378 const handler = yield* DesktopLinuxUrlHandler.DesktopLinuxUrlHandler;
379 yield* handler.register;
380 }).pipe(
381 Effect.provide(
382 DesktopLinuxUrlHandler.layer.pipe(
383 Layer.provide(
384 Layer.mergeAll(
385 Layer.effect(
386 DesktopEnvironment.DesktopEnvironment,
387 Path.Path.pipe(
388 Effect.map((path) =>
389 makeEnvironment(path, {
390 linuxApplicationsDir: path.join(run.root, "applications"),
391 }),
392 ),
393 ),
394 ),
395 Layer.effect(
396 DesktopAssets.DesktopAssets,
397 Path.Path.pipe(
398 Effect.map((path) => ({
399 iconPaths: Effect.succeed({
400 png: Option.none(),
401 ico: Option.none(),
402 icns: Option.none(),
403 }),
404 resolveResourcePath: (fileName: string) =>
405 Effect.succeed(
406 fileName === "icons/256x256.png"
407 ? Option.some(
408 path.join(
409 run.root,
410 run.sourceMissing ? "missing" : "resources",
411 fileName,
412 ),
413 )
414 : Option.none(),
415 ),
416 })),
417 ),
418 ),
419 Layer.succeed(
420 ChildProcessSpawner.ChildProcessSpawner,
421 ChildProcessSpawner.make((command) => {
422 const childProcess = command as unknown as {
423 readonly command: string;
424 readonly args: ReadonlyArray<string>;
425 };
426 run.commands.push({ command: childProcess.command, args: childProcess.args });
427 if (childProcess.command !== "gtk-update-icon-cache") {
428 return Effect.succeed(mockProcess(0));
429 }
430 run.iconCacheOptions?.push(
431 (command as unknown as { readonly options: Record<string, unknown> }).options,
432 );
433 if (run.iconCacheSpawnFails) {
434 return Effect.fail(
435 PlatformError.systemError({
436 _tag: "NotFound",
437 module: "ChildProcess",
438 method: "spawn",
439 description: "gtk-update-icon-cache is not installed",
440 }),
441 );
442 }
443 const exitCode = run.iconCacheExitCode ?? 0;
444 const handle = mockProcess(exitCode, run.iconCacheStalled === true);
445 const refreshed =
446 exitCode === 0 && run.onIconCacheRefresh ? run.onIconCacheRefresh : Effect.void;
447 return refreshed.pipe(
448 Effect.andThen(
449 run.iconCacheStarted
450 ? Deferred.succeed(run.iconCacheStarted, undefined)
451 : Effect.void,
452 ),
453 Effect.as(handle),
454 );
455 }),
456 ),
457 ),
458 ),
459 ),
460 ),
461 );
462​
463const themeIconFixture = (source: Uint8Array) =>
464 Effect.gen(function* () {
465 const fileSystem = yield* FileSystem.FileSystem;
466 const path = yield* Path.Path;
467 const root = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-theme-icons-" });
468 yield* fileSystem.makeDirectory(path.join(root, "resources", "icons"), { recursive: true });
469 yield* fileSystem.writeFile(path.join(root, "resources", "icons", "256x256.png"), source);
470 const hicolorDir = path.join(root, "icons", "hicolor");
471 const appsDir = path.join(hicolorDir, "256x256", "apps");
472 const cachePath = path.join(hicolorDir, "icon-theme.cache");
473 // A fixed time in the past, in whole seconds as fs.utimes expects.
474 const pastSeconds = 1_600_000_000;
475 // An existing cache that predates any installed icon.
476 const seedCache = Effect.gen(function* () {
477 yield* fileSystem.makeDirectory(appsDir, { recursive: true });
478 yield* fileSystem.writeFile(cachePath, new Uint8Array([0]));
479 yield* fileSystem.utimes(cachePath, pastSeconds, pastSeconds);
480 });
481 const rewriteCache = fileSystem
482 .writeFile(cachePath, new Uint8Array([1]))
483 .pipe(Effect.orDie, Effect.provideService(FileSystem.FileSystem, fileSystem));
484 return { root, hicolorDir, appsDir, cachePath, pastSeconds, seedCache, rewriteCache };
485 });
486​
487const iconCacheRuns = (run: ThemeIconRun) =>
488 run.commands.filter(({ command }) => command === "gtk-update-icon-cache").length;
489​
490it.layer(NodeServices.layer)("DesktopLinuxUrlHandler theme icons", (it) => {
491 it.effect("installs both app id spellings without creating an icon cache", () =>
492 Effect.gen(function* () {
493 const fileSystem = yield* FileSystem.FileSystem;
494 const path = yield* Path.Path;
495 const icon = new Uint8Array([137, 80, 78, 71, 1, 2, 3]);
496 const fixture = yield* themeIconFixture(icon);
497 const run: ThemeIconRun = { root: fixture.root, commands: [] };
498​
499 yield* registerWithRealFileSystem(run);
500 assert.deepEqual([...(yield* fileSystem.readDirectory(fixture.appsDir))].sort(), [
501 "com.t3tools.T3Code.png",
502 "com.t3tools.t3code.png",
503 ]);
504 for (const name of ["com.t3tools.t3code", "com.t3tools.T3Code"]) {
505 const target = path.join(fixture.appsDir, `${name}.png`);
506 assert.deepEqual([...(yield* fileSystem.readFile(target))], [...icon]);
507 yield* fileSystem.utimes(target, fixture.pastSeconds, fixture.pastSeconds);
508 }
509​
510 yield* registerWithRealFileSystem(run);
511 for (const name of ["com.t3tools.t3code", "com.t3tools.T3Code"]) {
512 const info = yield* fileSystem.stat(path.join(fixture.appsDir, `${name}.png`));
513 assert.equal(Option.getOrThrow(info.mtime).getTime(), fixture.pastSeconds * 1000);
514 }
515 assert.isFalse(yield* fileSystem.exists(fixture.cachePath));
516 assert.equal(iconCacheRuns(run), 0);
517 }).pipe(Effect.scoped),
518 );
519​
520 it.effect("replaces same-length stale icons and refreshes an existing cache once", () =>
521 Effect.gen(function* () {
522 const fileSystem = yield* FileSystem.FileSystem;
523 const path = yield* Path.Path;
524 const fixture = yield* themeIconFixture(new Uint8Array([1, 2, 3]));
525 yield* fixture.seedCache;
526 const lower = path.join(fixture.appsDir, "com.t3tools.t3code.png");
527 const upper = path.join(fixture.appsDir, "com.t3tools.T3Code.png");
528 yield* fileSystem.writeFile(lower, new Uint8Array([3, 2, 1]));
529 yield* fileSystem.writeFile(upper, new Uint8Array([1, 2, 3]));
530 for (const target of [lower, upper]) {
531 yield* fileSystem.utimes(target, fixture.pastSeconds, fixture.pastSeconds);
532 }
533 const run: ThemeIconRun = {
534 root: fixture.root,
535 commands: [],
536 onIconCacheRefresh: fixture.rewriteCache,
537 };
538​
539 yield* registerWithRealFileSystem(run);
540 yield* registerWithRealFileSystem(run);
541​
542 assert.deepEqual([...(yield* fileSystem.readFile(lower))], [1, 2, 3]);
543 const upperInfo = yield* fileSystem.stat(upper);
544 assert.equal(Option.getOrThrow(upperInfo.mtime).getTime(), fixture.pastSeconds * 1000);
545 assert.deepEqual(
546 run.commands.filter(({ command }) => command === "gtk-update-icon-cache"),
547 [{ command: "gtk-update-icon-cache", args: ["-f", "-t", fixture.hicolorDir] }],
548 );
549 }).pipe(Effect.scoped),
550 );
551​
552 it.effect("refreshes when this launch changed an icon even if the cache looks newer", () =>
553 Effect.gen(function* () {
554 const fileSystem = yield* FileSystem.FileSystem;
555 const path = yield* Path.Path;
556 const fixture = yield* themeIconFixture(new Uint8Array([1, 2, 3]));
557 yield* fixture.seedCache;
558 const run: ThemeIconRun = {
559 root: fixture.root,
560 commands: [],
561 onIconCacheRefresh: fixture.rewriteCache,
562 };
563 // A cache stamped later than the new icons, as after a clock correction.
564 const future = fixture.pastSeconds + 10 * 365 * 24 * 60 * 60;
565 yield* fileSystem.utimes(fixture.cachePath, future, future);
566​
567 yield* registerWithRealFileSystem(run);
568​
569 assert.isTrue(yield* fileSystem.exists(path.join(fixture.appsDir, "com.t3tools.T3Code.png")));
570 assert.equal(iconCacheRuns(run), 1);
571 }).pipe(Effect.scoped),
572 );
573​
574 it.effect("retries a failed icon cache refresh on the next launch", () =>
575 Effect.gen(function* () {
576 const fixture = yield* themeIconFixture(new Uint8Array([1, 2, 3]));
577 yield* fixture.seedCache;
578 const failing: ThemeIconRun = { root: fixture.root, commands: [], iconCacheExitCode: 1 };
579 yield* registerWithRealFileSystem(failing);
580 assert.equal(iconCacheRuns(failing), 1);
581 assert.deepEqual(failing.commands.map(({ command }) => command).slice(1), [
582 "update-desktop-database",
583 "xdg-mime",
584 ]);
585​
586 const recovering: ThemeIconRun = {
587 root: fixture.root,
588 commands: [],
589 onIconCacheRefresh: fixture.rewriteCache,
590 };
591 yield* registerWithRealFileSystem(recovering);
592 yield* registerWithRealFileSystem(recovering);
593 assert.equal(iconCacheRuns(recovering), 1);
594 }).pipe(Effect.scoped),
595 );
596​
597 it.effect("still registers the handler when the theme icon install fails", () =>
598 Effect.gen(function* () {
599 const fixture = yield* themeIconFixture(new Uint8Array([1, 2, 3]));
600 const missingSource: ThemeIconRun = { root: fixture.root, commands: [], sourceMissing: true };
601 yield* registerWithRealFileSystem(missingSource);
602 assert.deepEqual(
603 missingSource.commands.map(({ command }) => command),
604 ["update-desktop-database", "xdg-mime"],
605 );
606​
607 yield* fixture.seedCache;
608 const missingTool: ThemeIconRun = {
609 root: fixture.root,
610 commands: [],
611 iconCacheSpawnFails: true,
612 };
613 yield* registerWithRealFileSystem(missingTool);
614 assert.deepEqual(
615 missingTool.commands.map(({ command }) => command),
616 ["gtk-update-icon-cache", "update-desktop-database", "xdg-mime"],
617 );
618 }).pipe(Effect.scoped),
619 );
620});