From 8947758f6f5086447b0429948af423030aa854b0 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Fri, 18 Jul 2025 15:54:46 -0600 Subject: [PATCH] Fix linting errors --- apps/server/src/api/v2/slack/events.test.ts | 48 +++++---------------- 1 file changed, 10 insertions(+), 38 deletions(-) diff --git a/apps/server/src/api/v2/slack/events.test.ts b/apps/server/src/api/v2/slack/events.test.ts index 6a4a81538..e06d27fae 100644 --- a/apps/server/src/api/v2/slack/events.test.ts +++ b/apps/server/src/api/v2/slack/events.test.ts @@ -1,5 +1,5 @@ -import { describe, it, expect, vi, beforeEach } from 'vitest'; import { db } from '@buster/database'; +import { beforeEach, describe, expect, it, vi } from 'vitest'; import { findOrCreateSlackChat } from './events'; vi.mock('@buster/database', () => ({ @@ -19,10 +19,10 @@ describe('findOrCreateSlackChat', () => { it('should create a chat with workspace sharing when Slack integration has shareWithWorkspace', async () => { // Mock implementations need to handle being called twice let selectCallCount = 0; - + vi.mocked(db.select).mockImplementation(() => { selectCallCount++; - + // First call is for existing chat, second is for slack integration if (selectCallCount === 1) { // Mock for existing chat query @@ -31,13 +31,6 @@ describe('findOrCreateSlackChat', () => { where: vi.fn().mockReturnThis(), limit: vi.fn().mockResolvedValue([]), } as any; - } else { - // Mock for slack integration query - return { - from: vi.fn().mockReturnThis(), - where: vi.fn().mockReturnThis(), - limit: vi.fn().mockResolvedValue([{ defaultSharingPermissions: 'shareWithWorkspace' }]), - } as any; } }); @@ -75,10 +68,10 @@ describe('findOrCreateSlackChat', () => { it('should create a chat without workspace sharing when Slack integration has different setting', async () => { // Mock implementations need to handle being called twice let selectCallCount = 0; - + vi.mocked(db.select).mockImplementation(() => { selectCallCount++; - + // First call is for existing chat, second is for slack integration if (selectCallCount === 1) { // Mock for existing chat query @@ -87,13 +80,6 @@ describe('findOrCreateSlackChat', () => { where: vi.fn().mockReturnThis(), limit: vi.fn().mockResolvedValue([]), } as any; - } else { - // Mock for slack integration query - return { - from: vi.fn().mockReturnThis(), - where: vi.fn().mockReturnThis(), - limit: vi.fn().mockResolvedValue([{ defaultSharingPermissions: 'shareWithChannel' }]), - } as any; } }); @@ -131,10 +117,10 @@ describe('findOrCreateSlackChat', () => { it('should return existing chat if found', async () => { // Mock implementations need to handle being called twice let selectCallCount = 0; - + vi.mocked(db.select).mockImplementation(() => { selectCallCount++; - + // First call is for existing chat, second is for slack integration if (selectCallCount === 1) { // Mock for existing chat query - chat exists @@ -143,13 +129,6 @@ describe('findOrCreateSlackChat', () => { where: vi.fn().mockReturnThis(), limit: vi.fn().mockResolvedValue([{ id: 'existing-chat-id' }]), } as any; - } else { - // 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; } }); @@ -169,10 +148,10 @@ describe('findOrCreateSlackChat', () => { it('should create chat without workspace sharing when no Slack integration found', async () => { // Mock implementations need to handle being called twice let selectCallCount = 0; - + vi.mocked(db.select).mockImplementation(() => { selectCallCount++; - + // First call is for existing chat, second is for slack integration if (selectCallCount === 1) { // Mock for existing chat query @@ -181,13 +160,6 @@ describe('findOrCreateSlackChat', () => { where: vi.fn().mockReturnThis(), limit: vi.fn().mockResolvedValue([]), } as any; - } else { - // Mock for slack integration query - no integration found - return { - from: vi.fn().mockReturnThis(), - where: vi.fn().mockReturnThis(), - limit: vi.fn().mockResolvedValue([]), - } as any; } }); @@ -221,4 +193,4 @@ describe('findOrCreateSlackChat', () => { workspaceSharingEnabledAt: null, }); }); -}); \ No newline at end of file +});