mirror of https://github.com/buster-so/buster.git
update build
This commit is contained in:
parent
387508ee33
commit
512ce45a28
|
@ -30,7 +30,7 @@
|
||||||
"lineWidth": 100
|
"lineWidth": 100
|
||||||
},
|
},
|
||||||
"organizeImports": {
|
"organizeImports": {
|
||||||
"enabled": true
|
"enabled": false
|
||||||
},
|
},
|
||||||
"linter": {
|
"linter": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
|
|
@ -60,6 +60,10 @@ const nextConfig = {
|
||||||
eslint: {
|
eslint: {
|
||||||
ignoreDuringBuilds: true
|
ignoreDuringBuilds: true
|
||||||
},
|
},
|
||||||
|
// Disable TypeScript type checking during builds
|
||||||
|
typescript: {
|
||||||
|
ignoreBuildErrors: true
|
||||||
|
},
|
||||||
sassOptions: {
|
sassOptions: {
|
||||||
includePaths: [path.join(__dirname, 'styles')],
|
includePaths: [path.join(__dirname, 'styles')],
|
||||||
silenceDeprecations: ['legacy-js-api']
|
silenceDeprecations: ['legacy-js-api']
|
||||||
|
|
|
@ -4,14 +4,16 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev --turbo",
|
"dev": "next dev --turbo",
|
||||||
"build": "npm run lint:biome && next build",
|
"build": "npm run lint:biome && npm run typecheck && next build",
|
||||||
"build:skip-lint": "next build",
|
"build:skip-lint": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "npx biome check && next lint",
|
"lint": "npx biome check && npm run typecheck && next lint",
|
||||||
"lint:biome": "npx biome check",
|
"lint:biome": "npx biome check",
|
||||||
"lint:eslint": "next lint",
|
"lint:eslint": "next lint",
|
||||||
"lint:ci": "npx biome check",
|
"lint:ci": "npx biome check && npm run typecheck",
|
||||||
"lint:fix": "npx biome check --write",
|
"lint:fix": "npx biome check --write",
|
||||||
|
"typecheck": "tsc --noEmit",
|
||||||
|
"typecheck:watch": "tsc --noEmit --watch",
|
||||||
"test": "vitest",
|
"test": "vitest",
|
||||||
"test:watch": "vitest --watch",
|
"test:watch": "vitest --watch",
|
||||||
"test:ui": "vitest --ui",
|
"test:ui": "vitest --ui",
|
||||||
|
@ -80,7 +82,7 @@
|
||||||
"monaco-sql-languages": "^0.15.0",
|
"monaco-sql-languages": "^0.15.0",
|
||||||
"monaco-yaml": "^5.4.0",
|
"monaco-yaml": "^5.4.0",
|
||||||
"mutative": "^1.2.0",
|
"mutative": "^1.2.0",
|
||||||
"next": "14.2.28",
|
"next": "14.2.29",
|
||||||
"next-themes": "^0.4.6",
|
"next-themes": "^0.4.6",
|
||||||
"papaparse": "^5.5.3",
|
"papaparse": "^5.5.3",
|
||||||
"pluralize": "^8.0.0",
|
"pluralize": "^8.0.0",
|
||||||
|
|
|
@ -9,7 +9,7 @@ vi.mock('@/lib/messages', () => ({
|
||||||
isNumericColumnType: vi.fn()
|
isNumericColumnType: vi.fn()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const mockedIsNumericColumnType = isNumericColumnType as anyedFunction<typeof isNumericColumnType>;
|
const mockedIsNumericColumnType = vi.mocked(isNumericColumnType);
|
||||||
|
|
||||||
describe('canSupportTrendlineRecord', () => {
|
describe('canSupportTrendlineRecord', () => {
|
||||||
const trendlineTypes: Trendline['type'][] = [
|
const trendlineTypes: Trendline['type'][] = [
|
||||||
|
|
|
@ -44,8 +44,8 @@ describe('useXAxisTitle', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
// Default mock implementations
|
// Default mock implementations
|
||||||
(formatLabel as any).mockImplementation((value) => `formatted_${value}`);
|
(formatLabel as any).mockImplementation((value: string) => `formatted_${value}`);
|
||||||
(truncateWithEllipsis as any).mockImplementation((text) => text);
|
(truncateWithEllipsis as any).mockImplementation((text: string) => text);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return empty string when chart type is not supported', () => {
|
it('should return empty string when chart type is not supported', () => {
|
||||||
|
|
|
@ -42,8 +42,8 @@ describe('useY2AxisTitle', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
// Default mock implementations
|
// Default mock implementations
|
||||||
(formatLabel as any).mockImplementation((value) => `formatted_${value}`);
|
(formatLabel as any).mockImplementation((value: string) => `formatted_${value}`);
|
||||||
(truncateWithEllipsis as any).mockImplementation((text) => text);
|
(truncateWithEllipsis as any).mockImplementation((text: string) => text);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return empty string when chart type is not supported', () => {
|
it('should return empty string when chart type is not supported', () => {
|
||||||
|
|
|
@ -48,8 +48,8 @@ describe('useYAxisTitle', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
// Default mock implementations
|
// Default mock implementations
|
||||||
(formatLabel as any).mockImplementation((value) => `formatted_${value}`);
|
(formatLabel as any).mockImplementation((value: string) => `formatted_${value}`);
|
||||||
(truncateWithEllipsis as any).mockImplementation((text) => text);
|
(truncateWithEllipsis as any).mockImplementation((text: string) => text);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return empty string when chart type is not supported', () => {
|
it('should return empty string when chart type is not supported', () => {
|
||||||
|
|
|
@ -52,11 +52,10 @@ describe('barSeriesBuilder', () => {
|
||||||
yAxisKeys: ['sales'],
|
yAxisKeys: ['sales'],
|
||||||
y2AxisKeys: [],
|
y2AxisKeys: [],
|
||||||
xAxisKeys: ['date'],
|
xAxisKeys: ['date'],
|
||||||
categoryKeys: [],
|
trendlines: [],
|
||||||
sizeOptions: null,
|
sizeOptions: null,
|
||||||
scatterDotSize: [5, 5],
|
scatterDotSize: [5, 5],
|
||||||
lineGroupType: null,
|
lineGroupType: null
|
||||||
selectedChartType: ChartType.Bar
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
@ -143,11 +142,10 @@ describe('barSeriesBuilder', () => {
|
||||||
yAxisKeys: ['sales2022', 'sales2023'],
|
yAxisKeys: ['sales2022', 'sales2023'],
|
||||||
y2AxisKeys: [],
|
y2AxisKeys: [],
|
||||||
xAxisKeys: ['quarter'],
|
xAxisKeys: ['quarter'],
|
||||||
categoryKeys: [],
|
trendlines: [],
|
||||||
sizeOptions: null,
|
sizeOptions: null,
|
||||||
scatterDotSize: [5, 5],
|
scatterDotSize: [5, 5],
|
||||||
lineGroupType: null,
|
lineGroupType: null
|
||||||
selectedChartType: ChartType.Bar
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
@ -220,11 +218,10 @@ describe('barSeriesBuilder', () => {
|
||||||
yAxisKeys: ['marketShare'],
|
yAxisKeys: ['marketShare'],
|
||||||
y2AxisKeys: [],
|
y2AxisKeys: [],
|
||||||
xAxisKeys: ['product'],
|
xAxisKeys: ['product'],
|
||||||
categoryKeys: [],
|
|
||||||
sizeOptions: null,
|
sizeOptions: null,
|
||||||
scatterDotSize: [5, 5],
|
scatterDotSize: [5, 5],
|
||||||
lineGroupType: null,
|
lineGroupType: null,
|
||||||
selectedChartType: ChartType.Bar
|
trendlines: []
|
||||||
};
|
};
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
|
@ -44,7 +44,8 @@ describe('comboSeriesBuilder_data', () => {
|
||||||
scatterDotSize: [5, 10] as [number, number],
|
scatterDotSize: [5, 10] as [number, number],
|
||||||
barShowTotalAtTop: false,
|
barShowTotalAtTop: false,
|
||||||
yAxisKeys: ['metric1'],
|
yAxisKeys: ['metric1'],
|
||||||
y2AxisKeys: ['metric2']
|
y2AxisKeys: ['metric2'],
|
||||||
|
trendlines: []
|
||||||
};
|
};
|
||||||
|
|
||||||
const result = comboSeriesBuilder_data(props);
|
const result = comboSeriesBuilder_data(props);
|
||||||
|
@ -82,7 +83,8 @@ describe('comboSeriesBuilder_data', () => {
|
||||||
scatterDotSize: [5, 10] as [number, number],
|
scatterDotSize: [5, 10] as [number, number],
|
||||||
barShowTotalAtTop: false,
|
barShowTotalAtTop: false,
|
||||||
yAxisKeys: ['metric1'],
|
yAxisKeys: ['metric1'],
|
||||||
y2AxisKeys: []
|
y2AxisKeys: [],
|
||||||
|
trendlines: []
|
||||||
};
|
};
|
||||||
|
|
||||||
const result = comboSeriesBuilder_data(props);
|
const result = comboSeriesBuilder_data(props);
|
||||||
|
|
|
@ -121,6 +121,7 @@ describe('lineSeriesBuilder', () => {
|
||||||
xAxisKeys: ['category'] as ChartEncodes['x'],
|
xAxisKeys: ['category'] as ChartEncodes['x'],
|
||||||
lineGroupType: undefined,
|
lineGroupType: undefined,
|
||||||
index: 0,
|
index: 0,
|
||||||
|
trendlines: [],
|
||||||
dataset: {
|
dataset: {
|
||||||
id: 'm1',
|
id: 'm1',
|
||||||
axisType: 'y' as const,
|
axisType: 'y' as const,
|
||||||
|
|
|
@ -25,7 +25,7 @@ describe('useGetFileLink', () => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
|
|
||||||
// Mock useChatLayoutContextSelector to return our test values
|
// Mock useChatLayoutContextSelector to return our test values
|
||||||
(useChatLayoutContextSelector as any).mockImplementation((selector) => {
|
(useChatLayoutContextSelector as any).mockImplementation((selector: any) => {
|
||||||
const contextValues = {
|
const contextValues = {
|
||||||
metricVersionNumber: mockMetricVersionNumber,
|
metricVersionNumber: mockMetricVersionNumber,
|
||||||
dashboardVersionNumber: mockDashboardVersionNumber,
|
dashboardVersionNumber: mockDashboardVersionNumber,
|
||||||
|
@ -38,7 +38,12 @@ describe('useGetFileLink', () => {
|
||||||
|
|
||||||
// Mock assetParamsToRoute to return predictable values for testing
|
// Mock assetParamsToRoute to return predictable values for testing
|
||||||
(assetParamsToRoute as any).mockImplementation(
|
(assetParamsToRoute as any).mockImplementation(
|
||||||
({ assetId, type, versionNumber, secondaryView }) => {
|
({
|
||||||
|
assetId,
|
||||||
|
type,
|
||||||
|
versionNumber,
|
||||||
|
secondaryView
|
||||||
|
}: { assetId: string; type: string; versionNumber: number; secondaryView: string }) => {
|
||||||
if (type === 'metric') {
|
if (type === 'metric') {
|
||||||
return `/metrics/${assetId}${versionNumber ? `/v${versionNumber}` : ''}${secondaryView ? `/${secondaryView}` : ''}`;
|
return `/metrics/${assetId}${versionNumber ? `/v${versionNumber}` : ''}${secondaryView ? `/${secondaryView}` : ''}`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ describe('useChatInputFlow', () => {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
(useBusterNewChatContextSelector as any).mockImplementation((selector) => {
|
(useBusterNewChatContextSelector as any).mockImplementation((selector: any) => {
|
||||||
const state = {
|
const state = {
|
||||||
onStartNewChat: mockOnStartNewChat,
|
onStartNewChat: mockOnStartNewChat,
|
||||||
onFollowUpChat: mockOnFollowUpChat,
|
onFollowUpChat: mockOnFollowUpChat,
|
||||||
|
@ -50,7 +50,7 @@ describe('useChatInputFlow', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
it('should handle followup-chat flow', async () => {
|
it('should handle followup-chat flow', async () => {
|
||||||
(useChatIndividualContextSelector as any).mockImplementation((selector) => {
|
(useChatIndividualContextSelector as any).mockImplementation((selector: any) => {
|
||||||
const state = {
|
const state = {
|
||||||
hasChat: true,
|
hasChat: true,
|
||||||
chatId: 'test-chat-id',
|
chatId: 'test-chat-id',
|
||||||
|
@ -75,7 +75,7 @@ describe('useChatInputFlow', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle followup-metric flow', async () => {
|
it('should handle followup-metric flow', async () => {
|
||||||
(useChatIndividualContextSelector as any).mockImplementation((selector) => {
|
(useChatIndividualContextSelector as any).mockImplementation((selector: any) => {
|
||||||
const state = {
|
const state = {
|
||||||
hasChat: false,
|
hasChat: false,
|
||||||
chatId: 'test-chat-id',
|
chatId: 'test-chat-id',
|
||||||
|
@ -101,7 +101,7 @@ describe('useChatInputFlow', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle followup-dashboard flow', async () => {
|
it('should handle followup-dashboard flow', async () => {
|
||||||
(useChatIndividualContextSelector as any).mockImplementation((selector) => {
|
(useChatIndividualContextSelector as any).mockImplementation((selector: any) => {
|
||||||
const state = {
|
const state = {
|
||||||
hasChat: false,
|
hasChat: false,
|
||||||
chatId: 'test-chat-id',
|
chatId: 'test-chat-id',
|
||||||
|
@ -127,7 +127,7 @@ describe('useChatInputFlow', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle new chat flow', async () => {
|
it('should handle new chat flow', async () => {
|
||||||
(useChatIndividualContextSelector as any).mockImplementation((selector) => {
|
(useChatIndividualContextSelector as any).mockImplementation((selector: any) => {
|
||||||
const state = {
|
const state = {
|
||||||
hasChat: false,
|
hasChat: false,
|
||||||
chatId: 'test-chat-id',
|
chatId: 'test-chat-id',
|
||||||
|
@ -151,7 +151,7 @@ describe('useChatInputFlow', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle stop chat', () => {
|
it('should handle stop chat', () => {
|
||||||
(useChatIndividualContextSelector as any).mockImplementation((selector) => {
|
(useChatIndividualContextSelector as any).mockImplementation((selector: any) => {
|
||||||
const state = {
|
const state = {
|
||||||
hasChat: true,
|
hasChat: true,
|
||||||
chatId: 'test-chat-id',
|
chatId: 'test-chat-id',
|
||||||
|
@ -175,7 +175,7 @@ describe('useChatInputFlow', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not submit when disabled', async () => {
|
it('should not submit when disabled', async () => {
|
||||||
(useChatIndividualContextSelector as any).mockImplementation((selector) => {
|
(useChatIndividualContextSelector as any).mockImplementation((selector: any) => {
|
||||||
const state = {
|
const state = {
|
||||||
hasChat: true,
|
hasChat: true,
|
||||||
chatId: 'test-chat-id',
|
chatId: 'test-chat-id',
|
||||||
|
@ -196,7 +196,7 @@ describe('useChatInputFlow', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should stop chat when loading', async () => {
|
it('should stop chat when loading', async () => {
|
||||||
(useChatIndividualContextSelector as any).mockImplementation((selector) => {
|
(useChatIndividualContextSelector as any).mockImplementation((selector: any) => {
|
||||||
const state = {
|
const state = {
|
||||||
hasChat: true,
|
hasChat: true,
|
||||||
chatId: 'test-chat-id',
|
chatId: 'test-chat-id',
|
||||||
|
|
|
@ -32,7 +32,7 @@ describe('useLayoutConfig', () => {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
(useAppLayoutContextSelector as any).mockImplementation((selector) => {
|
(useAppLayoutContextSelector as any).mockImplementation((selector: any) => {
|
||||||
const state = {
|
const state = {
|
||||||
onChangePage: mockOnChangePage,
|
onChangePage: mockOnChangePage,
|
||||||
onChangeQueryParams: mockOnChangeQueryParams
|
onChangeQueryParams: mockOnChangeQueryParams
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
import type { SelectedFile } from '../../interfaces';
|
import type { SelectedFile } from '../../interfaces';
|
||||||
import type { useGetChatParams } from '../useGetChatParams';
|
|
||||||
|
|
||||||
export const createSelectedFile = (
|
export const createSelectedFile = (params: {
|
||||||
params: ReturnType<typeof useGetChatParams>
|
metricId?: string;
|
||||||
): SelectedFile | null => {
|
collectionId?: string;
|
||||||
|
datasetId?: string;
|
||||||
|
dashboardId?: string;
|
||||||
|
chatId?: string;
|
||||||
|
messageId?: string;
|
||||||
|
metricVersionNumber?: number;
|
||||||
|
dashboardVersionNumber?: number;
|
||||||
|
}): SelectedFile | null => {
|
||||||
const {
|
const {
|
||||||
metricId,
|
metricId,
|
||||||
collectionId,
|
collectionId,
|
||||||
|
|
|
@ -2,7 +2,7 @@ import type { FileType } from '@/api/asset_interfaces/chat';
|
||||||
import type { AppSplitterRef } from '@/components/ui/layouts/AppSplitter';
|
import type { AppSplitterRef } from '@/components/ui/layouts/AppSplitter';
|
||||||
import { BusterRoutes } from '@/routes';
|
import { BusterRoutes } from '@/routes';
|
||||||
import { act, renderHook } from '@testing-library/react';
|
import { act, renderHook } from '@testing-library/react';
|
||||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
import { type MockedFunction, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||||
import type { SelectedFile } from '../../interfaces';
|
import type { SelectedFile } from '../../interfaces';
|
||||||
import type { FileViewSecondary } from '../useLayoutConfig';
|
import type { FileViewSecondary } from '../useLayoutConfig';
|
||||||
import { createSelectedFile } from './createSelectedFile';
|
import { createSelectedFile } from './createSelectedFile';
|
||||||
|
@ -17,7 +17,7 @@ vi.mock('@/context/BusterAppLayout', () => ({
|
||||||
useAppLayoutContextSelector: vi.fn((selector) => mockOnChangePage)
|
useAppLayoutContextSelector: vi.fn((selector) => mockOnChangePage)
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const mockCreateSelectedFile = createSelectedFile as anyedFunction<typeof createSelectedFile>;
|
const mockCreateSelectedFile = createSelectedFile as MockedFunction<typeof createSelectedFile>;
|
||||||
|
|
||||||
describe('useSelectedFile', () => {
|
describe('useSelectedFile', () => {
|
||||||
const mockAnimateOpenSplitter = vi.fn();
|
const mockAnimateOpenSplitter = vi.fn();
|
||||||
|
|
|
@ -18,7 +18,7 @@ describe('useCloseVersionHistory', () => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
|
|
||||||
// Mock useAppLayoutContextSelector
|
// Mock useAppLayoutContextSelector
|
||||||
(useAppLayoutContextSelector as any).mockImplementation((selector) => {
|
(useAppLayoutContextSelector as any).mockImplementation((selector: any) => {
|
||||||
return selector({ onChangePage: mockOnChangePage });
|
return selector({ onChangePage: mockOnChangePage });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ describe('useCloseVersionHistory', () => {
|
||||||
mockGetInitialChatFileHref.mockReturnValue(expectedHref);
|
mockGetInitialChatFileHref.mockReturnValue(expectedHref);
|
||||||
|
|
||||||
// Mock chat layout context values
|
// Mock chat layout context values
|
||||||
(useChatLayoutContextSelector as any).mockImplementation((selector) =>
|
(useChatLayoutContextSelector as any).mockImplementation((selector: any) =>
|
||||||
selector({
|
selector({
|
||||||
chatId: 'chat-123',
|
chatId: 'chat-123',
|
||||||
metricId: 'metric-123',
|
metricId: 'metric-123',
|
||||||
|
@ -62,7 +62,7 @@ describe('useCloseVersionHistory', () => {
|
||||||
mockGetInitialChatFileHref.mockReturnValue(null);
|
mockGetInitialChatFileHref.mockReturnValue(null);
|
||||||
|
|
||||||
// Mock chat layout context values
|
// Mock chat layout context values
|
||||||
(useChatLayoutContextSelector as any).mockImplementation((selector) =>
|
(useChatLayoutContextSelector as any).mockImplementation((selector: any) =>
|
||||||
selector({
|
selector({
|
||||||
chatId: 'chat-123',
|
chatId: 'chat-123',
|
||||||
metricId: 'metric-123',
|
metricId: 'metric-123',
|
||||||
|
@ -81,7 +81,7 @@ describe('useCloseVersionHistory', () => {
|
||||||
mockGetInitialChatFileHref.mockReturnValue(expectedHref);
|
mockGetInitialChatFileHref.mockReturnValue(expectedHref);
|
||||||
|
|
||||||
// Mock chat layout context values
|
// Mock chat layout context values
|
||||||
(useChatLayoutContextSelector as any).mockImplementation((selector) =>
|
(useChatLayoutContextSelector as any).mockImplementation((selector: any) =>
|
||||||
selector({
|
selector({
|
||||||
chatId: 'chat-123',
|
chatId: 'chat-123',
|
||||||
metricId: 'metric-123',
|
metricId: 'metric-123',
|
||||||
|
@ -98,7 +98,7 @@ describe('useCloseVersionHistory', () => {
|
||||||
|
|
||||||
it('should return correct href when chatId is not present', () => {
|
it('should return correct href when chatId is not present', () => {
|
||||||
// Mock chat layout context values
|
// Mock chat layout context values
|
||||||
(useChatLayoutContextSelector as any).mockImplementation((selector) =>
|
(useChatLayoutContextSelector as any).mockImplementation((selector: any) =>
|
||||||
selector({
|
selector({
|
||||||
chatId: undefined,
|
chatId: undefined,
|
||||||
metricId: 'metric-123',
|
metricId: 'metric-123',
|
||||||
|
@ -119,7 +119,7 @@ describe('useCloseVersionHistory', () => {
|
||||||
mockGetInitialChatFileHref.mockReturnValue(expectedHref);
|
mockGetInitialChatFileHref.mockReturnValue(expectedHref);
|
||||||
|
|
||||||
// Mock chat layout context values
|
// Mock chat layout context values
|
||||||
(useChatLayoutContextSelector as any).mockImplementation((selector) =>
|
(useChatLayoutContextSelector as any).mockImplementation((selector: any) =>
|
||||||
selector({
|
selector({
|
||||||
chatId: undefined,
|
chatId: undefined,
|
||||||
metricId: 'metric-123',
|
metricId: 'metric-123',
|
||||||
|
|
|
@ -263,13 +263,13 @@ const useCollectionSelectMenu = ({ metricId }: { metricId: string }) => {
|
||||||
openInfoMessage('Metrics removed from collections');
|
openInfoMessage('Metrics removed from collections');
|
||||||
});
|
});
|
||||||
|
|
||||||
const { modal, ...dropdownProps } = useSaveToCollectionsDropdownContent({
|
const { ModalComponent, ...dropdownProps } = useSaveToCollectionsDropdownContent({
|
||||||
onSaveToCollection,
|
onSaveToCollection,
|
||||||
onRemoveFromCollection,
|
onRemoveFromCollection,
|
||||||
selectedCollections
|
selectedCollections
|
||||||
});
|
});
|
||||||
|
|
||||||
const collectionSubMenu = useMemo(() => {
|
const CollectionSubMenu = useMemo(() => {
|
||||||
return <DropdownContent {...dropdownProps} />;
|
return <DropdownContent {...dropdownProps} />;
|
||||||
}, [dropdownProps]);
|
}, [dropdownProps]);
|
||||||
|
|
||||||
|
@ -280,11 +280,11 @@ const useCollectionSelectMenu = ({ metricId }: { metricId: string }) => {
|
||||||
icon: <ASSET_ICONS.collectionAdd />,
|
icon: <ASSET_ICONS.collectionAdd />,
|
||||||
items: [
|
items: [
|
||||||
<React.Fragment key="collection-sub-menu">
|
<React.Fragment key="collection-sub-menu">
|
||||||
{collectionSubMenu} {modal}
|
{CollectionSubMenu} {ModalComponent}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
[collectionSubMenu]
|
[CollectionSubMenu]
|
||||||
);
|
);
|
||||||
|
|
||||||
return collectionDropdownItem;
|
return collectionDropdownItem;
|
||||||
|
|
|
@ -211,7 +211,7 @@ describe('assetParamsToRoute', () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('unsupported file type', () => {
|
it('unsupported file type', () => {
|
||||||
const consoleSpy = vi.spyOn(console, 'warn').mockImplementation();
|
const consoleSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
||||||
const result = assetParamsToRoute({
|
const result = assetParamsToRoute({
|
||||||
chatId: mockChatId,
|
chatId: mockChatId,
|
||||||
assetId: mockAssetId,
|
assetId: mockAssetId,
|
||||||
|
|
Loading…
Reference in New Issue