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
48 changes: 24 additions & 24 deletions apps/dev-playground/client/src/routes/chart-inference.route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ export const Route = createFileRoute("/chart-inference")({
});

// ---------------------------------------------------------------------------
// Helper to build a Genie-shaped statement_response from simple definitions
// Helper to build a Genie-shaped statement response from simple definitions
// ---------------------------------------------------------------------------

interface SampleColumn {
name: string;
type_name: string;
typeName: string;
}

function makeStatementResponse(
Expand All @@ -26,7 +26,7 @@ function makeStatementResponse(
) {
return {
manifest: { schema: { columns } },
result: { data_array: rows },
result: { dataArray: rows },
};
}

Expand All @@ -46,8 +46,8 @@ const SAMPLES: {
expected: "line",
data: makeStatementResponse(
[
{ name: "date", type_name: "DATE" },
{ name: "revenue", type_name: "DECIMAL" },
{ name: "date", typeName: "DATE" },
{ name: "revenue", typeName: "DECIMAL" },
],
[
["2024-01-01", "12000"],
Expand All @@ -71,8 +71,8 @@ const SAMPLES: {
expected: "pie",
data: makeStatementResponse(
[
{ name: "region", type_name: "STRING" },
{ name: "sales", type_name: "DECIMAL" },
{ name: "region", typeName: "STRING" },
{ name: "sales", typeName: "DECIMAL" },
],
[
["North America", "45000"],
Expand All @@ -87,8 +87,8 @@ const SAMPLES: {
expected: "bar",
data: makeStatementResponse(
[
{ name: "product", type_name: "STRING" },
{ name: "revenue", type_name: "DECIMAL" },
{ name: "product", typeName: "STRING" },
{ name: "revenue", typeName: "DECIMAL" },
],
Array.from({ length: 15 }, (_, i) => [
`Product ${String.fromCharCode(65 + i)}`,
Expand All @@ -102,8 +102,8 @@ const SAMPLES: {
expected: "line",
data: makeStatementResponse(
[
{ name: "city", type_name: "STRING" },
{ name: "population", type_name: "INT" },
{ name: "city", typeName: "STRING" },
{ name: "population", typeName: "INT" },
],
Array.from({ length: 150 }, (_, i) => [
`City ${i + 1}`,
Expand All @@ -117,9 +117,9 @@ const SAMPLES: {
expected: "line",
data: makeStatementResponse(
[
{ name: "month", type_name: "DATE" },
{ name: "revenue", type_name: "DECIMAL" },
{ name: "cost", type_name: "DECIMAL" },
{ name: "month", typeName: "DATE" },
{ name: "revenue", typeName: "DECIMAL" },
{ name: "cost", typeName: "DECIMAL" },
],
[
["2024-01-01", "12000", "8000"],
Expand All @@ -137,9 +137,9 @@ const SAMPLES: {
expected: "bar",
data: makeStatementResponse(
[
{ name: "department", type_name: "STRING" },
{ name: "budget", type_name: "DECIMAL" },
{ name: "actual", type_name: "DECIMAL" },
{ name: "department", typeName: "STRING" },
{ name: "budget", typeName: "DECIMAL" },
{ name: "actual", typeName: "DECIMAL" },
],
[
["Engineering", "500000", "480000"],
Expand All @@ -159,8 +159,8 @@ const SAMPLES: {
expected: "scatter",
data: makeStatementResponse(
[
{ name: "height_cm", type_name: "DOUBLE" },
{ name: "weight_kg", type_name: "DOUBLE" },
{ name: "height_cm", typeName: "DOUBLE" },
{ name: "weight_kg", typeName: "DOUBLE" },
],
Array.from({ length: 30 }, (_, i) => [
String(150 + i * 1.2),
Expand All @@ -174,8 +174,8 @@ const SAMPLES: {
expected: "none (table only)",
data: makeStatementResponse(
[
{ name: "metric", type_name: "STRING" },
{ name: "value", type_name: "DECIMAL" },
{ name: "metric", typeName: "STRING" },
{ name: "value", typeName: "DECIMAL" },
],
[["Total Revenue", "125000"]],
),
Expand All @@ -186,9 +186,9 @@ const SAMPLES: {
expected: "none (table only)",
data: makeStatementResponse(
[
{ name: "first_name", type_name: "STRING" },
{ name: "last_name", type_name: "STRING" },
{ name: "city", type_name: "STRING" },
{ name: "first_name", typeName: "STRING" },
{ name: "last_name", typeName: "STRING" },
{ name: "city", typeName: "STRING" },
],
[
["Alice", "Smith", "New York"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe("createMockWorkspaceClient — build the fake client yourself", () => {
});
expect(getMock(client, "jobs.getRun")).toHaveBeenCalledWith({ run_id: 1 });
await expect(
client.genie.getMessage({ id: "m-1" }),
client.genie.genieGetConversationMessage({ messageId: "m-1" }),
).resolves.toBeUndefined();
});
});
Expand Down
98 changes: 88 additions & 10 deletions docs/docs/api/appkit/Interface.WorkspaceClient.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/docs/plugins/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ await mock.attach(plugin);
```

`options` is:
- `responses` — seed the mock workspace client with responses keyed by dotted path (`"jobs.getRun"`, `"genie.getMessage"`). A value can be static or a function of call arguments and the abort signal.
- `responses` — seed the mock workspace client with responses keyed by dotted path (`"jobs.getRun"`, `"genie.genieGetConversationMessage"`). A value can be static or a function of call arguments and the abort signal.
- `env` — set environment variables scoped to the test; they are restored on plugin detach.
- `strict` — throw if a handler calls an undeclared workspace-client path (instead of silently resolving `undefined`). The built-in defaults still count as declared.

Expand Down Expand Up @@ -513,7 +513,7 @@ const client = createMockWorkspaceClient({
});

await client.jobs.getRun({ run_id: 1 }); // → { state: "TERMINATED" }
await client.genie.getMessage({ id: "m-1" }); // → undefined, does not throw
await client.genie.genieGetConversationMessage({ messageId: "m-1" }); // → undefined, does not throw
```

`createTestApp` installs one of these for you, so reach for it directly only when you're driving a plugin through `createTestPluginContext` or `mockServiceContext`.
Expand Down
1 change: 1 addition & 0 deletions knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@databricks/sdk-auth",
"@databricks/sdk-core",
"@databricks/sdk-experimental",
"@databricks/sdk-genie",
"@databricks/sdk-options",
"@databricks/sdk-scim",
"@databricks/sdk-statementexecution",
Expand Down
Loading
Loading