mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-08 17:34:51 +00:00
* feat(projects): add keyboard-driven project setup * test(app): update add project loading assertion * fix(projects): harden GitHub project setup
35 lines
985 B
TypeScript
35 lines
985 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import type { DesktopDialogBridge, DesktopDialogOpenOptions } from "./host";
|
|
import { pickDirectory } from "./pick-directory";
|
|
|
|
describe("pickDirectory", () => {
|
|
it("opens a single-directory picker and returns the selection", async () => {
|
|
const recordedOptions: DesktopDialogOpenOptions[] = [];
|
|
const dialog: DesktopDialogBridge = {
|
|
open: async (options) => {
|
|
if (options) {
|
|
recordedOptions.push(options);
|
|
}
|
|
return "/repo/project";
|
|
},
|
|
};
|
|
|
|
await expect(pickDirectory(dialog)).resolves.toBe("/repo/project");
|
|
expect(recordedOptions).toEqual([
|
|
{
|
|
directory: true,
|
|
multiple: false,
|
|
createDirectory: true,
|
|
},
|
|
]);
|
|
});
|
|
|
|
it("returns null when the picker is cancelled", async () => {
|
|
const dialog: DesktopDialogBridge = {
|
|
open: async () => null,
|
|
};
|
|
|
|
await expect(pickDirectory(dialog)).resolves.toBeNull();
|
|
});
|
|
});
|