fix(app): default project picker to home
This commit is contained in:
parent
81d5a3973d
commit
7865d69001
10 changed files with 31 additions and 8 deletions
|
|
@ -21,6 +21,11 @@ export class Info extends Schema.Class<Info>("Location.Info")({
|
|||
}),
|
||||
}) {}
|
||||
|
||||
export class Details extends Schema.Class<Details>("Location.Details")({
|
||||
...Info.fields,
|
||||
home: AbsolutePath,
|
||||
}) {}
|
||||
|
||||
export function response<S extends Schema.Top>(data: S) {
|
||||
return Schema.Struct({ location: Info, data })
|
||||
}
|
||||
|
|
|
|||
14
packages/schema/test/location.test.ts
Normal file
14
packages/schema/test/location.test.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { expect, test } from "bun:test"
|
||||
import { Schema } from "effect"
|
||||
import { Location } from "../src/location.js"
|
||||
|
||||
const details = {
|
||||
directory: "/project",
|
||||
project: { id: "project", directory: "/project", canonical: "/project" },
|
||||
home: "/home/user",
|
||||
}
|
||||
|
||||
test("Location.Details includes the server home directory", () => {
|
||||
expect(Schema.decodeUnknownSync(Location.Details)(details).home).toBe("/home/user")
|
||||
expect(() => Schema.decodeUnknownSync(Location.Details)({ ...details, home: undefined })).toThrow()
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue