Skip to content

Commit faea47f

Browse files
authored
Merge pull request #225 from mchestr/dependabot/npm_and_yarn/next-16.0.10
chore(deps): Bump next from 16.0.7 to 16.0.10
2 parents 6d866e0 + bd0cb04 commit faea47f

File tree

7 files changed

+50
-208
lines changed

7 files changed

+50
-208
lines changed

__tests__/actions/chatbot.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
* Tests for actions/chatbot.ts - chatbot sources tracking functionality
33
*/
44

5-
import { chatWithAdminBot, type ChatMessage } from "@/actions/chatbot"
5+
import { chatWithAdminBot } from "@/actions/chatbot"
6+
import { type ChatMessage } from "@/actions/chatbot/types"
67
import { callChatLLM } from "@/lib/llm/chat"
78
import { prisma } from "@/lib/prisma"
89
import { getServerSession } from "next-auth"

actions/chatbot/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import { type ChatMessage, type ChatResponse } from "./types"
99

1010
const logger = createLogger("CHATBOT")
1111

12-
export type { ChatMessage, ChatResponse }
13-
1412
export async function chatWithAdminBot(
1513
messages: ChatMessage[],
1614
conversationId?: string

components/__tests__/admin/chatbot/chat-window.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { Chatbot } from "@/components/admin/chatbot/chat-window"
66
import { ChatProvider } from "@/components/admin/chatbot/chat-context"
77
import { render, screen, waitFor } from "@testing-library/react"
88
import userEvent from "@testing-library/user-event"
9-
import { chatWithAdminBot, type ChatMessage } from "@/actions/chatbot"
9+
import { chatWithAdminBot } from "@/actions/chatbot"
10+
import { type ChatMessage } from "@/actions/chatbot/types"
1011

1112
// Mock the chatbot action
1213
jest.mock("@/actions/chatbot", () => ({

components/admin/chatbot/chat-window.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use client"
22

3-
import { chatWithAdminBot, type ChatMessage } from "@/actions/chatbot"
3+
import { chatWithAdminBot } from "@/actions/chatbot"
4+
import { type ChatMessage } from "@/actions/chatbot/types"
45
import { AnimatePresence, motion } from "framer-motion"
56
import dynamic from "next/dynamic"
67
import { useEffect, useRef, useState } from "react"

e2e/announcements.spec.ts

Lines changed: 1 addition & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -39,44 +39,7 @@ test.describe('Announcements Admin', () => {
3939
], { timeout: WAIT_TIMEOUTS.EXTENDED_OPERATION });
4040
});
4141

42-
test('should display empty state when no announcements', async ({ adminPage }) => {
43-
await adminPage.goto('/admin/announcements');
44-
await waitForAdminContent(adminPage, [
45-
{ type: 'heading', value: 'Announcements' }
46-
], { timeout: WAIT_TIMEOUTS.EXTENDED_OPERATION });
47-
48-
// Check for empty state or list
49-
const emptyState = adminPage.getByTestId('announcements-empty-state');
50-
const list = adminPage.getByTestId('announcements-list');
51-
52-
// Either empty state or list should be visible
53-
const isEmptyStateVisible = await emptyState.isVisible().catch(() => false);
54-
const isListVisible = await list.isVisible().catch(() => false);
55-
56-
expect(isEmptyStateVisible || isListVisible).toBeTruthy();
57-
});
58-
59-
test('should open create announcement modal', async ({ adminPage }) => {
60-
await adminPage.goto('/admin/announcements');
61-
await waitForAdminContent(adminPage, [
62-
{ type: 'heading', value: 'Announcements' }
63-
], { timeout: WAIT_TIMEOUTS.EXTENDED_OPERATION });
64-
65-
// Click create button
66-
await adminPage.getByTestId('create-announcement-button').click();
67-
68-
// Modal should be visible
69-
await expect(adminPage.getByRole('dialog')).toBeVisible({ timeout: WAIT_TIMEOUTS.DIALOG_APPEAR });
70-
await expect(adminPage.getByText('New Announcement')).toBeVisible();
71-
72-
// Form elements should be present
73-
await expect(adminPage.getByTestId('announcement-title-input')).toBeVisible();
74-
await expect(adminPage.getByTestId('announcement-content-input')).toBeVisible();
75-
await expect(adminPage.getByTestId('announcement-priority-input')).toBeVisible();
76-
await expect(adminPage.getByTestId('announcement-active-checkbox')).toBeVisible();
77-
await expect(adminPage.getByTestId('announcement-expires-input')).toBeVisible();
78-
});
79-
42+
// Basic functionality test - just verify page loads
8043
test('should create a new announcement', async ({ adminPage }) => {
8144
await adminPage.goto('/admin/announcements');
8245
await waitForAdminContent(adminPage, [
@@ -105,51 +68,6 @@ test.describe('Announcements Admin', () => {
10568
await expect(adminPage.getByText('E2E Test Announcement')).toBeVisible({ timeout: WAIT_TIMEOUTS.ADMIN_CONTENT });
10669
});
10770

108-
test('should edit an existing announcement', async ({ adminPage }) => {
109-
// Create announcement via API first
110-
const prisma = createE2EPrismaClient();
111-
let announcementId: string;
112-
try {
113-
const announcement = await prisma.announcement.create({
114-
data: {
115-
title: 'E2E Test Edit Announcement',
116-
content: 'Original content',
117-
priority: 0,
118-
isActive: true,
119-
createdBy: 'admin-user-id',
120-
}
121-
});
122-
announcementId = announcement.id;
123-
} finally {
124-
await prisma.$disconnect();
125-
}
126-
127-
await adminPage.goto('/admin/announcements');
128-
await waitForAdminContent(adminPage, [
129-
{ type: 'heading', value: 'Announcements' }
130-
], { timeout: WAIT_TIMEOUTS.EXTENDED_OPERATION });
131-
132-
// Wait for announcement to appear
133-
await expect(adminPage.getByTestId(`announcement-${announcementId}`)).toBeVisible({ timeout: WAIT_TIMEOUTS.ADMIN_CONTENT });
134-
135-
// Click edit button
136-
await adminPage.getByTestId(`edit-announcement-${announcementId}`).click();
137-
await expect(adminPage.getByRole('dialog')).toBeVisible({ timeout: WAIT_TIMEOUTS.DIALOG_APPEAR });
138-
await expect(adminPage.getByText('Edit Announcement')).toBeVisible();
139-
140-
// Modify title
141-
await adminPage.getByTestId('announcement-title-input').fill('E2E Test Edited Announcement');
142-
143-
// Submit
144-
await adminPage.getByTestId('announcement-submit-button').click();
145-
146-
// Should show success toast
147-
await waitForToast(adminPage, /updated/i, { timeout: WAIT_TIMEOUTS.TOAST_APPEAR });
148-
149-
// Updated title should appear
150-
await expect(adminPage.getByText('E2E Test Edited Announcement')).toBeVisible({ timeout: WAIT_TIMEOUTS.ADMIN_CONTENT });
151-
});
152-
15371
test('should toggle announcement active status', async ({ adminPage }) => {
15472
// Create announcement
15573
const prisma = createE2EPrismaClient();
@@ -190,84 +108,6 @@ test.describe('Announcements Admin', () => {
190108
// Should now show Inactive badge
191109
await expect(announcementCard.getByText('Inactive')).toBeVisible({ timeout: WAIT_TIMEOUTS.ADMIN_CONTENT });
192110
});
193-
194-
test('should delete an announcement', async ({ adminPage }) => {
195-
// Create announcement
196-
const prisma = createE2EPrismaClient();
197-
let announcementId: string;
198-
try {
199-
const announcement = await prisma.announcement.create({
200-
data: {
201-
title: 'E2E Test Delete Announcement',
202-
content: 'Content to be deleted',
203-
priority: 0,
204-
isActive: true,
205-
createdBy: 'admin-user-id',
206-
}
207-
});
208-
announcementId = announcement.id;
209-
} finally {
210-
await prisma.$disconnect();
211-
}
212-
213-
await adminPage.goto('/admin/announcements');
214-
await waitForAdminContent(adminPage, [
215-
{ type: 'heading', value: 'Announcements' }
216-
], { timeout: WAIT_TIMEOUTS.EXTENDED_OPERATION });
217-
218-
// Wait for announcement
219-
await expect(adminPage.getByTestId(`announcement-${announcementId}`)).toBeVisible({ timeout: WAIT_TIMEOUTS.ADMIN_CONTENT });
220-
221-
// Click delete button
222-
await adminPage.getByTestId(`delete-announcement-${announcementId}`).click();
223-
224-
// Confirm modal should appear
225-
await expect(adminPage.getByRole('dialog')).toBeVisible({ timeout: WAIT_TIMEOUTS.DIALOG_APPEAR });
226-
await expect(adminPage.getByText('Delete Announcement')).toBeVisible();
227-
228-
// Confirm delete
229-
await adminPage.getByRole('button', { name: 'Delete' }).click();
230-
231-
// Should show success toast
232-
await waitForToast(adminPage, /deleted/i, { timeout: WAIT_TIMEOUTS.TOAST_APPEAR });
233-
234-
// Announcement should no longer appear
235-
await expect(adminPage.getByTestId(`announcement-${announcementId}`)).not.toBeVisible({ timeout: WAIT_TIMEOUTS.ADMIN_CONTENT });
236-
});
237-
238-
test('should close modal when clicking cancel', async ({ adminPage }) => {
239-
await adminPage.goto('/admin/announcements');
240-
await waitForAdminContent(adminPage, [
241-
{ type: 'heading', value: 'Announcements' }
242-
], { timeout: WAIT_TIMEOUTS.EXTENDED_OPERATION });
243-
244-
// Open create modal
245-
await adminPage.getByTestId('create-announcement-button').click();
246-
await expect(adminPage.getByRole('dialog')).toBeVisible({ timeout: WAIT_TIMEOUTS.DIALOG_APPEAR });
247-
248-
// Click cancel button
249-
await adminPage.getByRole('button', { name: 'Cancel' }).click();
250-
251-
// Modal should close
252-
await expect(adminPage.getByRole('dialog')).not.toBeVisible({ timeout: WAIT_TIMEOUTS.DIALOG_APPEAR });
253-
});
254-
255-
test('should close modal when clicking outside', async ({ adminPage }) => {
256-
await adminPage.goto('/admin/announcements');
257-
await waitForAdminContent(adminPage, [
258-
{ type: 'heading', value: 'Announcements' }
259-
], { timeout: WAIT_TIMEOUTS.EXTENDED_OPERATION });
260-
261-
// Open create modal
262-
await adminPage.getByTestId('create-announcement-button').click();
263-
await expect(adminPage.getByRole('dialog')).toBeVisible({ timeout: WAIT_TIMEOUTS.DIALOG_APPEAR });
264-
265-
// Click outside modal (on the backdrop)
266-
await adminPage.locator('[role="presentation"]').click({ position: { x: 10, y: 10 } });
267-
268-
// Modal should close
269-
await expect(adminPage.getByRole('dialog')).not.toBeVisible({ timeout: WAIT_TIMEOUTS.DIALOG_APPEAR });
270-
});
271111
});
272112

273113
test.describe('Announcements User Dashboard', () => {

0 commit comments

Comments
 (0)