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