Switch to double quotes and reformat codebase with Biome
This commit is contained in:
@@ -38,9 +38,7 @@ describe("parseInlinePathToken", () => {
|
||||
|
||||
describe("parseFileProtocolUrl", () => {
|
||||
it("parses file URLs with line fragments", () => {
|
||||
expect(
|
||||
parseFileProtocolUrl("file:///Users/test/project/src/app.tsx#L81")
|
||||
).toEqual({
|
||||
expect(parseFileProtocolUrl("file:///Users/test/project/src/app.tsx#L81")).toEqual({
|
||||
raw: "file:///Users/test/project/src/app.tsx#L81",
|
||||
path: "/Users/test/project/src/app.tsx",
|
||||
lineStart: 81,
|
||||
@@ -49,9 +47,7 @@ describe("parseFileProtocolUrl", () => {
|
||||
});
|
||||
|
||||
it("parses file URLs without line fragments", () => {
|
||||
expect(
|
||||
parseFileProtocolUrl("file:///Users/test/project/src/app.tsx")
|
||||
).toEqual({
|
||||
expect(parseFileProtocolUrl("file:///Users/test/project/src/app.tsx")).toEqual({
|
||||
raw: "file:///Users/test/project/src/app.tsx",
|
||||
path: "/Users/test/project/src/app.tsx",
|
||||
lineStart: undefined,
|
||||
@@ -60,9 +56,7 @@ describe("parseFileProtocolUrl", () => {
|
||||
});
|
||||
|
||||
it("parses windows file URLs and line ranges", () => {
|
||||
expect(
|
||||
parseFileProtocolUrl("file:///C:/Users/test/project/src/app.tsx#L12-L20")
|
||||
).toEqual({
|
||||
expect(parseFileProtocolUrl("file:///C:/Users/test/project/src/app.tsx#L12-L20")).toEqual({
|
||||
raw: "file:///C:/Users/test/project/src/app.tsx#L12-L20",
|
||||
path: "C:/Users/test/project/src/app.tsx",
|
||||
lineStart: 12,
|
||||
@@ -72,9 +66,7 @@ describe("parseFileProtocolUrl", () => {
|
||||
|
||||
it("rejects non-file URLs and invalid ranges", () => {
|
||||
expect(parseFileProtocolUrl("https://example.com/test.ts#L10")).toBeNull();
|
||||
expect(
|
||||
parseFileProtocolUrl("file:///Users/test/project/src/app.tsx#L20-L12")
|
||||
).toBeNull();
|
||||
expect(parseFileProtocolUrl("file:///Users/test/project/src/app.tsx#L20-L12")).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -83,7 +75,7 @@ describe("parseAssistantFileLink", () => {
|
||||
expect(
|
||||
parseAssistantFileLink("/Users/test/project/src/app.tsx#L33", {
|
||||
workspaceRoot: "/Users/test/project",
|
||||
})
|
||||
}),
|
||||
).toEqual({
|
||||
raw: "/Users/test/project/src/app.tsx#L33",
|
||||
path: "/Users/test/project/src/app.tsx",
|
||||
@@ -96,7 +88,7 @@ describe("parseAssistantFileLink", () => {
|
||||
expect(
|
||||
parseAssistantFileLink("C:/repo/src/app.tsx#L12-L20", {
|
||||
workspaceRoot: "C:/repo",
|
||||
})
|
||||
}),
|
||||
).toEqual({
|
||||
raw: "C:/repo/src/app.tsx#L12-L20",
|
||||
path: "C:/repo/src/app.tsx",
|
||||
@@ -109,7 +101,7 @@ describe("parseAssistantFileLink", () => {
|
||||
expect(
|
||||
parseAssistantFileLink("file:///tmp/outside.txt", {
|
||||
workspaceRoot: "/Users/test/project",
|
||||
})
|
||||
}),
|
||||
).toEqual({
|
||||
raw: "file:///tmp/outside.txt",
|
||||
path: "/tmp/outside.txt",
|
||||
@@ -122,30 +114,26 @@ describe("parseAssistantFileLink", () => {
|
||||
expect(
|
||||
parseAssistantFileLink("/tmp/outside.txt", {
|
||||
workspaceRoot: "/Users/test/project",
|
||||
})
|
||||
}),
|
||||
).toBeNull();
|
||||
});
|
||||
|
||||
it("rejects external URLs", () => {
|
||||
expect(
|
||||
parseAssistantFileLink("https://example.com/Users/test/project/src/app.tsx")
|
||||
).toBeNull();
|
||||
expect(parseAssistantFileLink("https://example.com/Users/test/project/src/app.tsx")).toBeNull();
|
||||
});
|
||||
|
||||
it("rejects invalid line fragments", () => {
|
||||
expect(
|
||||
parseAssistantFileLink("/Users/test/project/src/app.tsx#L20-L12", {
|
||||
workspaceRoot: "/Users/test/project",
|
||||
})
|
||||
}),
|
||||
).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe("normalizeInlinePathTarget", () => {
|
||||
it("keeps relative file paths as file targets", () => {
|
||||
expect(
|
||||
normalizeInlinePathTarget("packages/app/src/components/message.tsx")
|
||||
).toEqual({
|
||||
expect(normalizeInlinePathTarget("packages/app/src/components/message.tsx")).toEqual({
|
||||
directory: "packages/app/src/components",
|
||||
file: "packages/app/src/components/message.tsx",
|
||||
});
|
||||
@@ -155,8 +143,8 @@ describe("normalizeInlinePathTarget", () => {
|
||||
expect(
|
||||
normalizeInlinePathTarget(
|
||||
"/Users/test/project/packages/app/src/components/message.tsx",
|
||||
"/Users/test/project"
|
||||
)
|
||||
"/Users/test/project",
|
||||
),
|
||||
).toEqual({
|
||||
directory: "packages/app/src/components",
|
||||
file: "packages/app/src/components/message.tsx",
|
||||
@@ -164,25 +152,21 @@ describe("normalizeInlinePathTarget", () => {
|
||||
});
|
||||
|
||||
it("keeps absolute paths outside cwd as absolute file targets", () => {
|
||||
expect(
|
||||
normalizeInlinePathTarget("/tmp/message.tsx", "/Users/test/project")
|
||||
).toEqual({
|
||||
expect(normalizeInlinePathTarget("/tmp/message.tsx", "/Users/test/project")).toEqual({
|
||||
directory: "/tmp",
|
||||
file: "/tmp/message.tsx",
|
||||
});
|
||||
});
|
||||
|
||||
it("treats cwd itself as the workspace root directory", () => {
|
||||
expect(
|
||||
normalizeInlinePathTarget("/Users/test/project", "/Users/test/project")
|
||||
).toEqual({
|
||||
expect(normalizeInlinePathTarget("/Users/test/project", "/Users/test/project")).toEqual({
|
||||
directory: ".",
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps trailing-slash paths as directories", () => {
|
||||
expect(
|
||||
normalizeInlinePathTarget("/Users/test/project/packages/app/", "/Users/test/project")
|
||||
normalizeInlinePathTarget("/Users/test/project/packages/app/", "/Users/test/project"),
|
||||
).toEqual({
|
||||
directory: "packages/app",
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user