Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,36 @@ describe(__filename, () => {
assert.strictEqual(item.copyText, "cat");
});

it("getTreeItem sets volume url with volumes path segment", async () => {
const stubManager = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (non-blocking): this hand-rolls a stubManager with an inline host, while the sibling tests use the shared mockConnectionManager. The inline stub is justified here because this test needs a host present, but if the surrounding tests have a helper for a host-configured manager it'd be worth reusing for consistency.

onDidChangeState: () => ({dispose() {}}),
databricksWorkspace: {
host: new URL("https://adb-123.azuredatabricks.net/"),
},
} as unknown as ConnectionManager;

const provider = new UnityCatalogTreeDataProvider(
stubManager,
stubStateStorage
);
disposables.push(provider);

const volume: UnityCatalogTreeNode = {
kind: "volume",
catalogName: "cat",
schemaName: "sch",
name: "ev",
fullName: "cat.sch.ev",
};
const item = provider.getTreeItem(volume) as UnityCatalogTreeItem;

assert(item.url, "url should be set");
assert(
item.url!.includes("explore/data/volumes/cat/sch/ev"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (non-blocking): consider asserting the exact URL with assert.strictEqual(item.url, "https://adb-123.azuredatabricks.net/explore/data/volumes/cat/sch/ev") instead of includes(...). A substring check won't catch accidental double-slashes or a wrong prefix/host being concatenated; an exact match locks the route down.

`url should contain explore/data/volumes/cat/sch/ev, got: ${item.url}`
);
});

it("getTreeItem omits url when no host", async () => {
const provider = new UnityCatalogTreeDataProvider(
instance(mockConnectionManager),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ export class UnityCatalogTreeDataProvider
case "function":
path = `functions/${fullNamePath}`;
break;
case "volume":
path = `volumes/${fullNamePath}`;
break;
}
return this.getExploreUrl(path);
}
Expand Down
Loading