lint errors done & unit tests passing

This commit is contained in:
dal 2025-07-18 16:02:24 -06:00
parent 9fb8778b63
commit 97a8bb4c56
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
4 changed files with 30 additions and 6 deletions

View File

@ -32,6 +32,12 @@ describe('findOrCreateSlackChat', () => {
limit: vi.fn().mockResolvedValue([]), limit: vi.fn().mockResolvedValue([]),
} as any; } as any;
} }
// Mock for slack integration query
return {
from: vi.fn().mockReturnThis(),
where: vi.fn().mockReturnThis(),
limit: vi.fn().mockResolvedValue([{ defaultSharingPermissions: 'shareWithWorkspace' }]),
} as any;
}); });
// Mock insert // Mock insert
@ -81,6 +87,12 @@ describe('findOrCreateSlackChat', () => {
limit: vi.fn().mockResolvedValue([]), limit: vi.fn().mockResolvedValue([]),
} as any; } as any;
} }
// Mock for slack integration query
return {
from: vi.fn().mockReturnThis(),
where: vi.fn().mockReturnThis(),
limit: vi.fn().mockResolvedValue([{ defaultSharingPermissions: 'shareWithChannel' }]),
} as any;
}); });
// Mock insert // Mock insert
@ -130,6 +142,12 @@ describe('findOrCreateSlackChat', () => {
limit: vi.fn().mockResolvedValue([{ id: 'existing-chat-id' }]), limit: vi.fn().mockResolvedValue([{ id: 'existing-chat-id' }]),
} as any; } as any;
} }
// Mock for slack integration query (won't be used due to early return)
return {
from: vi.fn().mockReturnThis(),
where: vi.fn().mockReturnThis(),
limit: vi.fn().mockResolvedValue([]),
} as any;
}); });
const result = await findOrCreateSlackChat({ const result = await findOrCreateSlackChat({
@ -161,6 +179,12 @@ describe('findOrCreateSlackChat', () => {
limit: vi.fn().mockResolvedValue([]), limit: vi.fn().mockResolvedValue([]),
} as any; } as any;
} }
// Mock for slack integration query - no integration found
return {
from: vi.fn().mockReturnThis(),
where: vi.fn().mockReturnThis(),
limit: vi.fn().mockResolvedValue([]),
} as any;
}); });
// Mock insert // Mock insert

View File

@ -136,7 +136,7 @@ describe('SlackHandler', () => {
await handler.handleOAuthCallback(mockContext); await handler.handleOAuthCallback(mockContext);
expect(mockContext.redirect).toHaveBeenCalledWith( expect(mockContext.redirect).toHaveBeenCalledWith(
'http://localhost:3000/app/settings/integrations?status=cancelled' '/app/settings/integrations?status=cancelled'
); );
}); });
@ -146,7 +146,7 @@ describe('SlackHandler', () => {
await handler.handleOAuthCallback(mockContext); await handler.handleOAuthCallback(mockContext);
expect(mockContext.redirect).toHaveBeenCalledWith( expect(mockContext.redirect).toHaveBeenCalledWith(
'http://localhost:3000/app/settings/integrations?status=error&error=invalid_parameters' '/app/settings/integrations?status=error&error=invalid_parameters'
); );
}); });
@ -171,7 +171,7 @@ describe('SlackHandler', () => {
state: 'test-state', state: 'test-state',
}); });
expect(mockContext.redirect).toHaveBeenCalledWith( expect(mockContext.redirect).toHaveBeenCalledWith(
'http://localhost:3000/dashboard?status=success&workspace=Test%20Workspace' '/dashboard?status=success&workspace=Test%20Workspace'
); );
}); });
@ -191,7 +191,7 @@ describe('SlackHandler', () => {
await handler.handleOAuthCallback(mockContext); await handler.handleOAuthCallback(mockContext);
expect(mockContext.redirect).toHaveBeenCalledWith( expect(mockContext.redirect).toHaveBeenCalledWith(
'http://localhost:3000/app/settings/integrations?status=error&error=invalid_state' '/app/settings/integrations?status=error&error=invalid_state'
); );
}); });
}); });

View File

@ -29,7 +29,7 @@ describe('chartConfigProps', () => {
}); });
it('should have the expected color palette', () => { it('should have the expected color palette', () => {
expect(DEFAULT_CHART_CONFIG.colors).toBeUndefined(); expect(DEFAULT_CHART_CONFIG.colors).toEqual(DEFAULT_CHART_THEME);
expect(DEFAULT_CHART_THEME).toEqual([ expect(DEFAULT_CHART_THEME).toEqual([
'#B399FD', '#B399FD',
'#FC8497', '#FC8497',

View File

@ -12,7 +12,7 @@ describe('DEFAULT_CHART_CONFIG', () => {
const config = parseResult.data; const config = parseResult.data;
// Test key default values // Test key default values
expect(config.colors).toBeUndefined(); expect(config.colors).toEqual(DEFAULT_CHART_THEME);
expect(config.gridLines).toBe(true); expect(config.gridLines).toBe(true);
expect(config.showLegendHeadline).toBe(false); expect(config.showLegendHeadline).toBe(false);
expect(config.disableTooltip).toBe(false); expect(config.disableTooltip).toBe(false);