fix broken unit tests

This commit is contained in:
Nate Kelley 2025-04-15 12:40:52 -06:00
parent de24ee7539
commit 3a19fa7c4b
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
4 changed files with 34 additions and 10 deletions

View File

@ -384,7 +384,8 @@ describe('assetParamsToRoute', () => {
expect(result).toBe(
createBusterRoute({
route: BusterRoutes.APP_DASHBOARD_ID,
dashboardId: mockAssetId
dashboardId: mockAssetId,
secondaryView: 'version-history'
})
);
});
@ -443,8 +444,7 @@ describe('assetParamsToRoute', () => {
expect(result).toBe(
createBusterRoute({
route: BusterRoutes.APP_DASHBOARD_ID,
dashboardId: mockAssetId,
chatId: mockChatId
dashboardId: mockAssetId
})
);
});

View File

@ -103,10 +103,28 @@ const createDashboardRoute = ({
versionNumber?: number;
}) => {
if (chatId) {
if (versionNumber) {
return createBusterRoute({
route: BusterRoutes.APP_CHAT_ID_DASHBOARD_ID_VERSION_NUMBER,
chatId,
dashboardId,
versionNumber,
secondaryView
});
}
return createBusterRoute({
route: BusterRoutes.APP_CHAT_ID_DASHBOARD_ID_VERSION_NUMBER,
route: BusterRoutes.APP_CHAT_ID_DASHBOARD_ID,
chatId,
dashboardId,
secondaryView
});
}
if (versionNumber) {
return createBusterRoute({
route: BusterRoutes.APP_DASHBOARD_ID_VERSION_NUMBER,
dashboardId,
versionNumber,
secondaryView
});
@ -115,7 +133,6 @@ const createDashboardRoute = ({
return createBusterRoute({
route: BusterRoutes.APP_DASHBOARD_ID,
dashboardId,
versionNumber,
secondaryView
});
};

View File

@ -10,7 +10,8 @@ export enum BusterAppRoutes {
APP_METRIC_ID_FILE = '/app/metrics/:metricId/file',
APP_METRIC_ID_RESULTS = '/app/metrics/:metricId/results?secondary_view=:secondaryView',
APP_DASHBOARDS = '/app/dashboards',
APP_DASHBOARD_ID = '/app/dashboards/:dashboardId',
APP_DASHBOARD_ID = '/app/dashboards/:dashboardId?secondary_view=:secondaryView',
APP_DASHBOARD_ID_VERSION_NUMBER = '/app/dashboards/:dashboardId?dashboard_version_number=:versionNumber&secondary_view=:secondaryView',
APP_DASHBOARD_ID_FILE = '/app/dashboards/:dashboardId/file',
APP_LOGS = '/app/logs',
APP_DATASETS = '/app/datasets',
@ -77,6 +78,7 @@ export type BusterAppRoutesWithArgs = {
[BusterAppRoutes.APP_DASHBOARD_ID]: {
route: BusterAppRoutes.APP_DASHBOARD_ID;
dashboardId: string;
secondaryView?: DashboardFileViewSecondary;
};
[BusterAppRoutes.APP_DASHBOARD_ID_FILE]: {
route: BusterAppRoutes.APP_DASHBOARD_ID_FILE;
@ -158,6 +160,13 @@ export type BusterAppRoutesWithArgs = {
route: BusterAppRoutes.APP_CHAT_ID_DASHBOARD_ID;
chatId: string;
dashboardId: string;
secondaryView?: DashboardFileViewSecondary;
};
[BusterAppRoutes.APP_DASHBOARD_ID_VERSION_NUMBER]: {
route: BusterAppRoutes.APP_DASHBOARD_ID_VERSION_NUMBER;
dashboardId: string;
versionNumber: number;
secondaryView?: DashboardFileViewSecondary;
};
[BusterAppRoutes.APP_CHAT_ID_DASHBOARD_ID_VERSION_NUMBER]: {
route: BusterAppRoutes.APP_CHAT_ID_DASHBOARD_ID_VERSION_NUMBER;

View File

@ -21,10 +21,8 @@ export const pathNameToRoute = (pathName: string, params: any): BusterRoutes =>
[BusterRoutes.APP_DATASETS_ID_OVERVIEW]: BusterRoutes.APP_DATASETS,
[BusterRoutes.APP_DATASETS_ID_EDITOR]: BusterRoutes.APP_DATASETS,
[BusterRoutes.APP_TERMS_ID]: BusterRoutes.APP_TERMS,
[BusterRoutes.APP_METRIC_ID_VERSION_HISTORY_NUMBER]:
BusterRoutes.APP_METRIC_ID_VERSION_HISTORY_NUMBER,
[BusterRoutes.APP_CHAT_ID_DASHBOARD_ID_VERSION_HISTORY_NUMBER]:
BusterRoutes.APP_CHAT_ID_DASHBOARD_ID_VERSION_HISTORY_NUMBER
[BusterRoutes.APP_METRIC_ID_VERSION_NUMBER]: BusterRoutes.APP_METRIC,
[BusterRoutes.APP_DASHBOARD_ID_VERSION_NUMBER]: BusterRoutes.APP_DASHBOARDS
};
if (route && paramRoutesToParent[route as string]) {