diff --git a/ui/jest.config.ts b/ui/jest.config.ts index d6c08bc9..e36aab35 100644 --- a/ui/jest.config.ts +++ b/ui/jest.config.ts @@ -19,7 +19,7 @@ const config: Config = { customExportConditions: [] }, setupFilesAfterEnv: [ - '/tests/setupJest.ts' + '/tests/setup-jest.ts' ], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], moduleDirectories: ['node_modules', ''], diff --git a/ui/src/access/Session.ts b/ui/src/access/Session.ts index 9f37f9c3..5db36db9 100644 --- a/ui/src/access/Session.ts +++ b/ui/src/access/Session.ts @@ -1,4 +1,4 @@ -import User from './User'; +import User from './user'; export interface SessionData { user: User; diff --git a/ui/src/access/AuthenticationService.ts b/ui/src/access/authentication.ts similarity index 91% rename from ui/src/access/AuthenticationService.ts rename to ui/src/access/authentication.ts index 0ab1d854..a4798066 100644 --- a/ui/src/access/AuthenticationService.ts +++ b/ui/src/access/authentication.ts @@ -3,10 +3,10 @@ import { cookies } from 'next/headers'; import { redirect } from 'next/navigation'; import { IronSession, getIronSession } from 'iron-session'; -import { SessionData, SessionOptions } from './Session'; -import User, { AnonymousUser } from './User'; -import { validateTicket } from './Saml11Validator'; -import { setRoles } from './AuthorizationService'; +import { SessionData, SessionOptions } from './session'; +import User, { AnonymousUser } from './user'; +import { validateTicket } from './saml-11-validator'; +import { setRoles } from './authorization'; import { isDeepStrictEqual } from 'util'; const casUrl = process.env.NEXT_PUBLIC_CAS_URL as string; diff --git a/ui/src/access/AuthorizationService.ts b/ui/src/access/authorization.ts similarity index 96% rename from ui/src/access/AuthorizationService.ts rename to ui/src/access/authorization.ts index c61a14ef..77f8c4da 100644 --- a/ui/src/access/AuthorizationService.ts +++ b/ui/src/access/authorization.ts @@ -1,7 +1,7 @@ 'use server'; -import User from './User'; -import Role from './Role'; +import User from './user'; +import Role from './role'; const apiBaseUrl = process.env.NEXT_PUBLIC_API_2_1_BASE_URL as string; diff --git a/ui/src/access/Role.ts b/ui/src/access/role.ts similarity index 100% rename from ui/src/access/Role.ts rename to ui/src/access/role.ts diff --git a/ui/src/access/Saml11Validator.ts b/ui/src/access/saml-11-validator.ts similarity index 97% rename from ui/src/access/Saml11Validator.ts rename to ui/src/access/saml-11-validator.ts index d046fc2b..c526ac7b 100644 --- a/ui/src/access/Saml11Validator.ts +++ b/ui/src/access/saml-11-validator.ts @@ -1,4 +1,4 @@ -import User, { AnonymousUser } from './User'; +import User, { AnonymousUser } from './user'; import uniqid from 'uniqid'; import { format } from 'util'; import { transform } from 'camaro'; diff --git a/ui/src/access/User.ts b/ui/src/access/user.ts similarity index 71% rename from ui/src/access/User.ts rename to ui/src/access/user.ts index e73b3937..9f309eec 100644 --- a/ui/src/access/User.ts +++ b/ui/src/access/user.ts @@ -1,5 +1,5 @@ -import { MemberResult } from '@/groupings/GroupingsApiResults'; -import Role from './Role'; +import { MemberResult } from '@/models/groupings-api-results'; +import Role from './role'; type User = { roles: Role[] diff --git a/ui/src/services/EmailService.ts b/ui/src/actions/email.ts similarity index 87% rename from ui/src/services/EmailService.ts rename to ui/src/actions/email.ts index 204ec896..3ebf5549 100644 --- a/ui/src/services/EmailService.ts +++ b/ui/src/actions/email.ts @@ -1,8 +1,8 @@ 'use server'; -import { getCurrentUser } from '@/access/AuthenticationService'; -import { ApiError } from '@/groupings/GroupingsApiResults'; -import { postRequest } from './FetchService'; +import { getCurrentUser } from '@/access/authentication'; +import { ApiError } from '@/models/groupings-api-results'; +import { postRequest } from './http-client'; const baseUrl = process.env.NEXT_PUBLIC_API_BASE_URL as string; diff --git a/ui/src/services/GroupingsApiService.ts b/ui/src/actions/groupings-api.ts similarity index 99% rename from ui/src/services/GroupingsApiService.ts rename to ui/src/actions/groupings-api.ts index 66ea81a4..620ed5d6 100644 --- a/ui/src/services/GroupingsApiService.ts +++ b/ui/src/actions/groupings-api.ts @@ -1,6 +1,6 @@ 'use server'; -import { getCurrentUser } from '@/access/AuthenticationService'; +import { getCurrentUser } from '@/access/authentication'; import { Announcements, ApiError, @@ -19,7 +19,7 @@ import { GroupingUpdateDescriptionResult, MemberAttributeResults, MembershipResults -} from '../groupings/GroupingsApiResults'; +} from '@/models/groupings-api-results'; import { deleteRequest, deleteRequestAsync, @@ -29,7 +29,7 @@ import { postRequestRetry, putRequest, putRequestAsync -} from './FetchService'; +} from './http-client'; const baseUrl = process.env.NEXT_PUBLIC_API_2_1_BASE_URL as string; diff --git a/ui/src/services/FetchService.ts b/ui/src/actions/http-client.ts similarity index 98% rename from ui/src/services/FetchService.ts rename to ui/src/actions/http-client.ts index 4b2c73dd..8316e942 100644 --- a/ui/src/services/FetchService.ts +++ b/ui/src/actions/http-client.ts @@ -1,8 +1,8 @@ 'use server'; -import { ApiError } from '../groupings/GroupingsApiResults'; -import { getCurrentUser } from '@/access/AuthenticationService'; -import { sendStackTrace } from './EmailService'; +import { ApiError } from '@/models/groupings-api-results'; +import { getCurrentUser } from '@/access/authentication'; +import { sendStackTrace } from './email'; const maxRetries = 3; const baseUrl = process.env.NEXT_PUBLIC_API_2_1_BASE_URL as string; diff --git a/ui/src/app/(index)/_components/AfterLogin.tsx b/ui/src/app/(home)/_components/after-login.tsx similarity index 97% rename from ui/src/app/(index)/_components/AfterLogin.tsx rename to ui/src/app/(home)/_components/after-login.tsx index 2fe623f1..f1bd9542 100644 --- a/ui/src/app/(index)/_components/AfterLogin.tsx +++ b/ui/src/app/(home)/_components/after-login.tsx @@ -1,12 +1,12 @@ -import Role from '@/access/Role'; +import Role from '@/access/role'; import Image from 'next/image'; import { KeyRound } from 'lucide-react'; import Link from 'next/link'; import { Button } from '@/components/ui/button'; -import { getNumberOfGroupings, getNumberOfMemberships } from '@/services/GroupingsApiService'; -import { getCurrentUser } from '@/access/AuthenticationService'; +import { getNumberOfGroupings, getNumberOfMemberships } from '@/actions/groupings-api'; +import { getCurrentUser } from '@/access/authentication'; -const AfterLogin = async ()=>{ +const AfterLogin = async () => { const [currentUser, numberOfGroupings, numberOfMemberships] = await Promise.all([ getCurrentUser(), getNumberOfGroupings(), diff --git a/ui/src/app/(index)/_components/Announcements.tsx b/ui/src/app/(home)/_components/announcements.tsx similarity index 94% rename from ui/src/app/(index)/_components/Announcements.tsx rename to ui/src/app/(home)/_components/announcements.tsx index e3253c78..ac8fe16e 100644 --- a/ui/src/app/(index)/_components/Announcements.tsx +++ b/ui/src/app/(home)/_components/announcements.tsx @@ -1,6 +1,6 @@ import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'; import { AlertCircle } from 'lucide-react'; -import { getAnnouncements } from '@/services/GroupingsApiService'; +import { getAnnouncements } from '@/actions/groupings-api'; const Announcements = async () => { const announcements = await getAnnouncements(); diff --git a/ui/src/app/(index)/_components/BeforeLogin.tsx b/ui/src/app/(home)/_components/before-login.tsx similarity index 91% rename from ui/src/app/(index)/_components/BeforeLogin.tsx rename to ui/src/app/(home)/_components/before-login.tsx index 2a1c0ef1..cca2036b 100644 --- a/ui/src/app/(index)/_components/BeforeLogin.tsx +++ b/ui/src/app/(home)/_components/before-login.tsx @@ -1,6 +1,6 @@ import { Button } from '@/components/ui/button'; import { ArrowRight } from 'lucide-react'; -import UHGroupingsInfo from '@/components/UHGroupingsInfo'; +import UHGroupingsInfo from '@/components/uh-groupings-info'; const BeforeLogin = () => (
diff --git a/ui/src/app/(index)/_components/LoginButton.tsx b/ui/src/app/(home)/_components/login-button.tsx similarity index 81% rename from ui/src/app/(index)/_components/LoginButton.tsx rename to ui/src/app/(home)/_components/login-button.tsx index 544f01c9..997e5284 100644 --- a/ui/src/app/(index)/_components/LoginButton.tsx +++ b/ui/src/app/(home)/_components/login-button.tsx @@ -1,8 +1,9 @@ 'use client'; + import { Button } from '@/components/ui/button'; -import Role from '@/access/Role'; -import User from '@/access/User'; -import { login, logout } from '@/access/AuthenticationService'; +import Role from '@/access/role'; +import User from '@/access/user'; +import { login, logout } from '@/access/authentication'; const LoginButton = ({ currentUser diff --git a/ui/src/app/(index)/page.tsx b/ui/src/app/(home)/page.tsx similarity index 83% rename from ui/src/app/(index)/page.tsx rename to ui/src/app/(home)/page.tsx index 523a51de..61a2bbdd 100644 --- a/ui/src/app/(index)/page.tsx +++ b/ui/src/app/(home)/page.tsx @@ -1,10 +1,10 @@ import Image from 'next/image'; -import BeforeLogin from '@/app/(index)/_components/BeforeLogin'; -import AfterLogin from '@/app/(index)/_components/AfterLogin'; -import { getCurrentUser } from '@/access/AuthenticationService'; -import Role from '@/access/Role'; -import LoginButton from '@/app/(index)/_components/LoginButton'; -import Announcements from '@/app/(index)/_components/Announcements'; +import BeforeLogin from '@/app/(home)/_components/before-login'; +import AfterLogin from '@/app/(home)/_components/after-login'; +import { getCurrentUser } from '@/access/authentication'; +import Role from '@/access/role'; +import LoginButton from '@/app/(home)/_components/login-button'; +import Announcements from '@/app/(home)/_components/announcements'; const Home = async () => { const currentUser = await getCurrentUser(); diff --git a/ui/src/app/about/page.tsx b/ui/src/app/about/page.tsx index 92d02ce0..16a0b13c 100644 --- a/ui/src/app/about/page.tsx +++ b/ui/src/app/about/page.tsx @@ -1,4 +1,4 @@ -import UHGroupingsInfo from '@/components/UHGroupingsInfo'; +import UHGroupingsInfo from '@/components/uh-groupings-info'; const About = () => (
diff --git a/ui/src/app/api/cas/login/route.ts b/ui/src/app/api/cas/login/route.ts index e1649eaf..cf7d8e4f 100644 --- a/ui/src/app/api/cas/login/route.ts +++ b/ui/src/app/api/cas/login/route.ts @@ -1,6 +1,6 @@ import { redirect } from 'next/navigation'; import type { NextRequest } from 'next/server'; -import { handleLogin } from '@/access/AuthenticationService'; +import { handleLogin } from '@/access/authentication'; const baseUrl = process.env.NEXT_PUBLIC_BASE_URL as string; diff --git a/ui/src/app/api/cas/logout/route.ts b/ui/src/app/api/cas/logout/route.ts index 2d7b4681..6fb133e5 100644 --- a/ui/src/app/api/cas/logout/route.ts +++ b/ui/src/app/api/cas/logout/route.ts @@ -1,5 +1,5 @@ import { redirect } from 'next/navigation'; -import { handleLogout } from '@/access/AuthenticationService'; +import { handleLogout } from '@/access/authentication'; const baseUrl = process.env.NEXT_PUBLIC_BASE_URL as string; diff --git a/ui/src/app/layout.tsx b/ui/src/app/layout.tsx index 89dd57ab..3bb590bc 100644 --- a/ui/src/app/layout.tsx +++ b/ui/src/app/layout.tsx @@ -1,8 +1,8 @@ import './globals.css'; import { Source_Sans_3 } from 'next/font/google'; -import Footer from '@/components/layout/footer/Footer'; +import Footer from '@/components/layout/footer/footer'; import type { Metadata } from 'next'; -import Navbar from '@/components/layout/navbar/Navbar'; +import Navbar from '@/components/layout/navbar/navbar'; const sourceSans3 = Source_Sans_3({ subsets: ['latin'], diff --git a/ui/src/components/layout/navbar/Navbar.tsx b/ui/src/components/layout/navbar/Navbar.tsx index 12da83ed..dddfb642 100644 --- a/ui/src/components/layout/navbar/Navbar.tsx +++ b/ui/src/components/layout/navbar/Navbar.tsx @@ -1,11 +1,11 @@ import Link from 'next/link'; import Image from 'next/image'; -import LoginButton from './LoginButton'; -import { getCurrentUser } from '@/access/AuthenticationService'; -import MobileNavbar from './MobileNavbar'; -import { NavLinks } from './NavLinks'; -import Role from '@/access/Role'; -import TimeoutModal from '@/components/modal/TimeoutModal'; +import LoginButton from './login-button'; +import { getCurrentUser } from '@/access/authentication'; +import MobileNavbar from './mobile-navbar'; +import { NavLinks } from './nav-links'; +import Role from '@/access/role'; +import TimeoutModal from '@/components/modal/timeout-modal'; const Navbar = async () => { const currentUser = await getCurrentUser(); diff --git a/ui/src/components/layout/navbar/LoginButton.tsx b/ui/src/components/layout/navbar/login-button.tsx similarity index 85% rename from ui/src/components/layout/navbar/LoginButton.tsx rename to ui/src/components/layout/navbar/login-button.tsx index 0059c6a0..fad36e75 100644 --- a/ui/src/components/layout/navbar/LoginButton.tsx +++ b/ui/src/components/layout/navbar/login-button.tsx @@ -1,9 +1,9 @@ 'use client'; import { Button } from '@/components/ui/button'; -import Role from '@/access/Role'; -import User from '@/access/User'; -import { login, logout } from '@/access/AuthenticationService'; +import Role from '@/access/role'; +import User from '@/access/user'; +import { login, logout } from '@/access/authentication'; import { LogInIcon, LogOutIcon } from 'lucide-react'; const LoginButton = ({ diff --git a/ui/src/components/layout/navbar/MobileNavbar.tsx b/ui/src/components/layout/navbar/mobile-navbar.tsx similarity index 95% rename from ui/src/components/layout/navbar/MobileNavbar.tsx rename to ui/src/components/layout/navbar/mobile-navbar.tsx index 3fe018f8..333d5c08 100644 --- a/ui/src/components/layout/navbar/MobileNavbar.tsx +++ b/ui/src/components/layout/navbar/mobile-navbar.tsx @@ -5,11 +5,11 @@ import { SheetContent, SheetTrigger, } from '@/components/ui/sheet' -import User from '@/access/User'; +import User from '@/access/user'; import Link from 'next/link'; -import { NavLinks } from './NavLinks'; +import { NavLinks } from './nav-links'; import { useState } from 'react'; -import Role from '@/access/Role'; +import Role from '@/access/role'; const MobileNavbar = ({ currentUser diff --git a/ui/src/components/layout/navbar/NavLinks.ts b/ui/src/components/layout/navbar/nav-links.ts similarity index 93% rename from ui/src/components/layout/navbar/NavLinks.ts rename to ui/src/components/layout/navbar/nav-links.ts index ad29ae8e..63fb9bdb 100644 --- a/ui/src/components/layout/navbar/NavLinks.ts +++ b/ui/src/components/layout/navbar/nav-links.ts @@ -1,4 +1,4 @@ -import Role from '@/access/Role'; +import Role from '@/access/role'; export const NavLinks = [ { diff --git a/ui/src/components/modal/TimeoutModal.tsx b/ui/src/components/modal/timeout-modal.tsx similarity index 95% rename from ui/src/components/modal/TimeoutModal.tsx rename to ui/src/components/modal/timeout-modal.tsx index c3479aa2..aecac090 100644 --- a/ui/src/components/modal/TimeoutModal.tsx +++ b/ui/src/components/modal/timeout-modal.tsx @@ -12,9 +12,9 @@ import { AlertDialogCancel } from '@/components/ui/alert-dialog'; import { useIdleTimer } from 'react-idle-timer'; -import { logout } from '@/access/AuthenticationService'; -import User from '@/access/User'; -import Role from '@/access/Role'; +import { logout } from '@/access/authentication'; +import User from '@/access/user'; +import Role from '@/access/role'; const timeout = 1000 * 60 * 30; // Total timeout - 30 minutes in milliseconds const promptBeforeIdle = 1000 * 60 * 5; // Time prior to timeout until modal opens - 5 minutes in milliseconds diff --git a/ui/src/components/UHGroupingsInfo.tsx b/ui/src/components/uh-groupings-info.tsx similarity index 100% rename from ui/src/components/UHGroupingsInfo.tsx rename to ui/src/components/uh-groupings-info.tsx diff --git a/ui/src/middleware.ts b/ui/src/middleware.ts index 81c7dbcb..6b538ac8 100644 --- a/ui/src/middleware.ts +++ b/ui/src/middleware.ts @@ -1,8 +1,8 @@ import { cookies } from 'next/headers'; import { NextResponse, NextRequest } from 'next/server'; import { getIronSession } from 'iron-session'; -import { SessionData, SessionOptions } from './access/Session'; -import Role from './access/Role'; +import { SessionData, SessionOptions } from '@/access/session'; +import Role from '@/access/role'; /** * Next.js middleware function that is called upon visiting a route that matches the config. diff --git a/ui/src/groupings/GroupingsApiResults.ts b/ui/src/models/groupings-api-results.ts similarity index 100% rename from ui/src/groupings/GroupingsApiResults.ts rename to ui/src/models/groupings-api-results.ts diff --git a/ui/tests/access/AuthenticationService.test.ts b/ui/tests/access/authentication.test.ts similarity index 93% rename from ui/tests/access/AuthenticationService.test.ts rename to ui/tests/access/authentication.test.ts index fd936217..19c0478d 100644 --- a/ui/tests/access/AuthenticationService.test.ts +++ b/ui/tests/access/authentication.test.ts @@ -1,6 +1,6 @@ -import { getCurrentUser, login, logout, handleLogin, handleLogout } from '@/access/AuthenticationService'; -import { createMockSession } from '../setupJest'; -import User, { AnonymousUser } from '@/access/User'; +import { getCurrentUser, login, logout, handleLogin, handleLogout } from '@/access/authentication'; +import { createMockSession } from '../setup-jest'; +import User, { AnonymousUser } from '@/access/user'; import { redirect } from 'next/navigation'; import IronSession from 'iron-session'; @@ -9,7 +9,7 @@ const casUrl = process.env.NEXT_PUBLIC_CAS_URL as string; const testUser: User = JSON.parse(process.env.TEST_USER_A as string); const xmlSoapResponse = process.env.XML_SOAP_RESPONSE as string; -describe('AuthenticationService', () => { +describe('authentication', () => { describe('getCurrentUser', () => { diff --git a/ui/tests/access/AuthorizationService.test.ts b/ui/tests/access/authorization.test.ts similarity index 93% rename from ui/tests/access/AuthorizationService.test.ts rename to ui/tests/access/authorization.test.ts index e208770f..579cc4fa 100644 --- a/ui/tests/access/AuthorizationService.test.ts +++ b/ui/tests/access/authorization.test.ts @@ -1,11 +1,10 @@ -import { setRoles } from '@/access/AuthorizationService'; -import Role from '@/access/Role'; -import User, { AnonymousUser } from '@/access/User'; +import { setRoles } from '@/access/authorization'; +import Role from '@/access/role'; +import User, { AnonymousUser } from '@/access/user'; const testUser: User = JSON.parse(process.env.TEST_USER_A as string); -const apiBaseUrl = process.env.NEXT_PUBLIC_API_2_1_BASE_URL as string; -describe('AuthorizationService', () => { +describe('authorization', () => { describe('setRoles', () => { diff --git a/ui/tests/access/Role.test.ts b/ui/tests/access/role.test.ts similarity index 74% rename from ui/tests/access/Role.test.ts rename to ui/tests/access/role.test.ts index 8d37b46f..b5202622 100644 --- a/ui/tests/access/Role.test.ts +++ b/ui/tests/access/role.test.ts @@ -1,6 +1,6 @@ -import Role from '@/access/Role'; +import Role from '@/access/role'; -describe('Role', () => { +describe('role', () => { it('should have the same key and value', () => { for (const [key, value] of Object.entries(Role)) { diff --git a/ui/tests/access/Saml11Validator.test.ts b/ui/tests/access/saml-11-validator.test.ts similarity index 85% rename from ui/tests/access/Saml11Validator.test.ts rename to ui/tests/access/saml-11-validator.test.ts index f8e525aa..97dd313b 100644 --- a/ui/tests/access/Saml11Validator.test.ts +++ b/ui/tests/access/saml-11-validator.test.ts @@ -1,11 +1,11 @@ -import { validateTicket } from '@/access/Saml11Validator'; -import User, { AnonymousUser } from '@/access/User'; +import { validateTicket } from '@/access/saml-11-validator'; +import User, { AnonymousUser } from '@/access/user'; const testUser: User = JSON.parse(process.env.TEST_USER_A as string); const xmlSoapResponse = process.env.XML_SOAP_RESPONSE as string; const xmlSoapResponseRequestDenied = process.env.XML_SOAP_RESPONSE_REQUEST_DENIED as string; -describe('Saml11Validator', () => { +describe('saml-11-validator', () => { describe('validateTicket', () => { diff --git a/ui/tests/access/User.test.ts b/ui/tests/access/user.test.ts similarity index 80% rename from ui/tests/access/User.test.ts rename to ui/tests/access/user.test.ts index 00718823..250dfa96 100644 --- a/ui/tests/access/User.test.ts +++ b/ui/tests/access/user.test.ts @@ -1,7 +1,7 @@ -import Role from '@/access/Role'; -import { AnonymousUser } from '@/access/User'; +import Role from '@/access/role'; +import { AnonymousUser } from '@/access/user'; -describe('User', () => { +describe('user', () => { describe('AnonymousUser', () => { diff --git a/ui/tests/services/EmailService.test.ts b/ui/tests/actions/email.test.ts similarity index 85% rename from ui/tests/services/EmailService.test.ts rename to ui/tests/actions/email.test.ts index 50d2662c..c300a3f3 100644 --- a/ui/tests/services/EmailService.test.ts +++ b/ui/tests/actions/email.test.ts @@ -1,13 +1,13 @@ -import User from '@/access/User'; -import { Feedback, sendFeedback, sendStackTrace } from '@/services/EmailService'; -import * as AuthenticationService from '@/access/AuthenticationService'; +import User from '@/access/user'; +import { Feedback, sendFeedback, sendStackTrace } from '@/actions/email'; +import * as AuthenticationService from '@/access/authentication'; const baseUrl = process.env.NEXT_PUBLIC_API_BASE_URL as string; const testUser: User = JSON.parse(process.env.TEST_USER_A as string); -jest.mock('@/access/AuthenticationService'); +jest.mock('@/access/authentication'); -describe('EmailService', () => { +describe('email', () => { const currentUser = testUser; diff --git a/ui/tests/services/GroupingsApiService.test.ts b/ui/tests/actions/groupings-api.test.ts similarity index 99% rename from ui/tests/services/GroupingsApiService.test.ts rename to ui/tests/actions/groupings-api.test.ts index 24e28875..8ee95152 100644 --- a/ui/tests/services/GroupingsApiService.test.ts +++ b/ui/tests/actions/groupings-api.test.ts @@ -34,17 +34,17 @@ import { resetIncludeGroup, resetIncludeGroupAsync, updateDescription -} from '@/services/GroupingsApiService'; -import * as AuthenticationService from '@/access/AuthenticationService'; -import User from '@/access/User'; +} from '@/actions/groupings-api'; +import * as AuthenticationService from '@/access/authentication'; +import User from '@/access/user'; const baseUrl = process.env.NEXT_PUBLIC_API_2_1_BASE_URL as string; const testUser: User = JSON.parse(process.env.TEST_USER_A as string); -jest.mock('@/access/AuthenticationService'); -jest.mock('@/services/EmailService'); +jest.mock('@/access/authentication'); +jest.mock('@/actions/email'); -describe('GroupingsService', () => { +describe('groupings-api', () => { const currentUser = testUser; diff --git a/ui/tests/app/(index)/_components/AfterLogin.test.tsx b/ui/tests/app/(home)/_components/after-login.test.tsx similarity index 93% rename from ui/tests/app/(index)/_components/AfterLogin.test.tsx rename to ui/tests/app/(home)/_components/after-login.test.tsx index 52e6edbf..df651712 100644 --- a/ui/tests/app/(index)/_components/AfterLogin.test.tsx +++ b/ui/tests/app/(home)/_components/after-login.test.tsx @@ -1,15 +1,16 @@ -import Role from '@/access/Role' +import Role from '@/access/role' import { render, screen } from '@testing-library/react'; -import User from '@/access/User'; -import * as GroupingsApiService from '@/services/GroupingsApiService'; -import * as AuthenticationService from '@/access/AuthenticationService'; -import afterLogin from '@/app/(index)/_components/AfterLogin'; +import User from '@/access/user'; +import * as GroupingsApiService from '@/actions/groupings-api'; +import * as AuthenticationService from '@/access/authentication'; +import afterLogin from '@/app/(home)/_components/after-login'; + +jest.mock('@/actions/groupings-api'); +jest.mock('@/access/authentication'); -jest.mock('@/services/GroupingsApiService'); -jest.mock('@/access/AuthenticationService'); const testUser: User = JSON.parse(process.env.TEST_USER_A as string); -describe('AfterLogin', () => { +describe('after-login', () => { const numberOfGroupings = 18; const numberOfMemberships = 17; diff --git a/ui/tests/app/(index)/_components/Announcement.test.tsx b/ui/tests/app/(home)/_components/announcements.test.tsx similarity index 82% rename from ui/tests/app/(index)/_components/Announcement.test.tsx rename to ui/tests/app/(home)/_components/announcements.test.tsx index 093d43ac..c5f85e4a 100644 --- a/ui/tests/app/(index)/_components/Announcement.test.tsx +++ b/ui/tests/app/(home)/_components/announcements.test.tsx @@ -1,8 +1,8 @@ import { render, screen } from '@testing-library/react'; -import Announcements from '@/app/(index)/_components/Announcements'; -import * as GroupingsApiService from '@/services/GroupingsApiService'; +import Announcements from '@/app/(home)/_components/announcements'; +import * as GroupingsApiService from '@/actions/groupings-api'; -jest.mock('@/services/GroupingsApiService'); +jest.mock('@/actions/groupings-api'); const message = 'test announcement'; const message1 = 'test1 announcement'; @@ -16,7 +16,7 @@ const announcements = { ] }; -describe('Announcements Component', () => { +describe('announcements', () => { it('renders announcement correctly', async () => { jest.spyOn(GroupingsApiService, 'getAnnouncements').mockResolvedValue(announcements); render(await Announcements()); diff --git a/ui/tests/app/(index)/_components/BeforeLogin.test.tsx b/ui/tests/app/(home)/_components/before-login.test.tsx similarity index 93% rename from ui/tests/app/(index)/_components/BeforeLogin.test.tsx rename to ui/tests/app/(home)/_components/before-login.test.tsx index 8f134a50..d4e63062 100644 --- a/ui/tests/app/(index)/_components/BeforeLogin.test.tsx +++ b/ui/tests/app/(home)/_components/before-login.test.tsx @@ -1,6 +1,6 @@ import { render, screen } from '@testing-library/react'; -import BeforeLogin from '@/app/(index)/_components/BeforeLogin'; -describe('BeforeLogin Component', () => { +import BeforeLogin from '@/app/(home)/_components/before-login'; +describe('before-login', () => { it('renders UHGroupingsInfo and a button with correct text and link', ()=> { render(); diff --git a/ui/tests/app/(index)/_components/LoginButton.test.tsx b/ui/tests/app/(home)/_components/login-button.test.tsx similarity index 89% rename from ui/tests/app/(index)/_components/LoginButton.test.tsx rename to ui/tests/app/(home)/_components/login-button.test.tsx index a7b84bca..ddfc1cea 100644 --- a/ui/tests/app/(index)/_components/LoginButton.test.tsx +++ b/ui/tests/app/(home)/_components/login-button.test.tsx @@ -1,14 +1,14 @@ import { render, screen, fireEvent } from '@testing-library/react'; import { redirect } from 'next/navigation'; -import User, { AnonymousUser } from '@/access/User'; -import Role from '@/access/Role'; -import LoginButton from '@/app/(index)/_components/LoginButton'; +import User, { AnonymousUser } from '@/access/user'; +import Role from '@/access/role'; +import LoginButton from '@/app/(home)/_components/login-button'; const casUrl = process.env.NEXT_PUBLIC_CAS_URL as string; const baseUrl = process.env.NEXT_PUBLIC_BASE_URL as string; const testUser: User = JSON.parse(process.env.TEST_USER_A as string); -describe('LoginButton Component', () => { +describe('login-button', () => { describe('User is not logged in', () => { it('should render a Login button', () => { diff --git a/ui/tests/app/about/page.test.tsx b/ui/tests/app/about/page.test.tsx index 2d6a1af5..742c27f8 100644 --- a/ui/tests/app/about/page.test.tsx +++ b/ui/tests/app/about/page.test.tsx @@ -1,7 +1,7 @@ import { render, screen } from '@testing-library/react'; import About from '@/app/about/page'; -describe('About', () => { +describe('about', () => { it('should render the About page with the appropriate headers, images and links', () => { render(); diff --git a/ui/tests/app/api/cas/login/route.test.ts b/ui/tests/app/api/cas/login/route.test.ts index 35e29630..b1e032f5 100644 --- a/ui/tests/app/api/cas/login/route.test.ts +++ b/ui/tests/app/api/cas/login/route.test.ts @@ -1,11 +1,11 @@ import { GET } from '@/app/api/cas/login/route'; import { redirect } from 'next/navigation'; -import { handleLogin } from '@/access/AuthenticationService'; +import { handleLogin } from '@/access/authentication'; import { NextRequest } from 'next/server'; const baseUrl = process.env.NEXT_PUBLIC_BASE_URL as string; -jest.mock('@/access/AuthenticationService'); +jest.mock('@/access/authentication'); describe('/api/cas/login', () => { diff --git a/ui/tests/app/api/cas/logout/route.test.ts b/ui/tests/app/api/cas/logout/route.test.ts index 1374af4b..22625174 100644 --- a/ui/tests/app/api/cas/logout/route.test.ts +++ b/ui/tests/app/api/cas/logout/route.test.ts @@ -1,10 +1,10 @@ import { GET } from '@/app/api/cas/logout/route'; import { redirect } from 'next/navigation'; -import { handleLogout } from '@/access/AuthenticationService'; +import { handleLogout } from '@/access/authentication'; const baseUrl = process.env.NEXT_PUBLIC_BASE_URL as string; -jest.mock('@/access/AuthenticationService'); +jest.mock('@/access/authentication'); describe('/api/cas/logout', () => { diff --git a/ui/tests/components/layout/footer/Footer.test.tsx b/ui/tests/components/layout/footer/Footer.test.tsx index 810e8896..a4118e0b 100644 --- a/ui/tests/components/layout/footer/Footer.test.tsx +++ b/ui/tests/components/layout/footer/Footer.test.tsx @@ -1,5 +1,5 @@ import { render, screen } from '@testing-library/react'; -import Footer from '@/components/layout/footer/Footer'; +import Footer from '@/components/layout/footer/footer'; describe ('Footer', () => { diff --git a/ui/tests/components/layout/navbar/LoginButton.test.tsx b/ui/tests/components/layout/navbar/login-button.test.tsx similarity index 92% rename from ui/tests/components/layout/navbar/LoginButton.test.tsx rename to ui/tests/components/layout/navbar/login-button.test.tsx index dba73f42..9e9c1f7a 100644 --- a/ui/tests/components/layout/navbar/LoginButton.test.tsx +++ b/ui/tests/components/layout/navbar/login-button.test.tsx @@ -1,8 +1,8 @@ import { render, screen, fireEvent } from '@testing-library/react'; -import Login from '@/components/layout/navbar/LoginButton'; +import Login from '@/components/layout/navbar/login-button'; import { redirect } from 'next/navigation'; -import User, { AnonymousUser } from '@/access/User'; -import Role from '@/access/Role'; +import User, { AnonymousUser } from '@/access/user'; +import Role from '@/access/role'; const casUrl = process.env.NEXT_PUBLIC_CAS_URL as string; const baseUrl = process.env.NEXT_PUBLIC_BASE_URL as string; diff --git a/ui/tests/components/layout/navbar/MobileNavbar.test.tsx b/ui/tests/components/layout/navbar/mobile-navbar.test.tsx similarity index 96% rename from ui/tests/components/layout/navbar/MobileNavbar.test.tsx rename to ui/tests/components/layout/navbar/mobile-navbar.test.tsx index 810a7c89..69645167 100644 --- a/ui/tests/components/layout/navbar/MobileNavbar.test.tsx +++ b/ui/tests/components/layout/navbar/mobile-navbar.test.tsx @@ -1,6 +1,6 @@ -import Role from '@/access/Role'; -import User, { AnonymousUser } from '@/access/User'; -import MobileNavbar from '@/components/layout/navbar/MobileNavbar'; +import Role from '@/access/role'; +import User, { AnonymousUser } from '@/access/user'; +import MobileNavbar from '@/components/layout/navbar/mobile-navbar'; import { fireEvent, render, screen } from '@testing-library/react'; const testUser: User = JSON.parse(process.env.TEST_USER_A as string); diff --git a/ui/tests/components/layout/navbar/Navbar.test.tsx b/ui/tests/components/layout/navbar/navbar.test.tsx similarity index 95% rename from ui/tests/components/layout/navbar/Navbar.test.tsx rename to ui/tests/components/layout/navbar/navbar.test.tsx index 4bcd7c0f..2ee2ca3a 100644 --- a/ui/tests/components/layout/navbar/Navbar.test.tsx +++ b/ui/tests/components/layout/navbar/navbar.test.tsx @@ -1,12 +1,12 @@ -import User, { AnonymousUser } from '@/access/User'; -import * as AuthenticationService from '@/access/AuthenticationService'; +import User, { AnonymousUser } from '@/access/user'; +import * as AuthenticationService from '@/access/authentication'; import { render, screen } from '@testing-library/react'; -import Navbar from '@/components/layout/navbar/Navbar'; -import Role from '@/access/Role'; +import Navbar from '@/components/layout/navbar/navbar'; +import Role from '@/access/role'; const testUser: User = JSON.parse(process.env.TEST_USER_A as string); -jest.mock('@/access/AuthenticationService'); +jest.mock('@/access/authentication'); describe('Navbar', () => { diff --git a/ui/tests/components/modal/TimeoutModal.test.tsx b/ui/tests/components/modal/timeout-modal.test.tsx similarity index 93% rename from ui/tests/components/modal/TimeoutModal.test.tsx rename to ui/tests/components/modal/timeout-modal.test.tsx index 053bff4f..84b69eda 100644 --- a/ui/tests/components/modal/TimeoutModal.test.tsx +++ b/ui/tests/components/modal/timeout-modal.test.tsx @@ -1,12 +1,12 @@ -import Role from '@/access/Role'; -import User from '@/access/User'; -import TimeoutModal from '@/components/modal/TimeoutModal'; +import Role from '@/access/role'; +import User from '@/access/user'; +import TimeoutModal from '@/components/modal/timeout-modal'; import { act, fireEvent, render, screen } from '@testing-library/react'; -import * as AuthenticationService from '@/access/AuthenticationService'; +import * as AuthenticationService from '@/access/authentication'; const testUser: User = JSON.parse(process.env.TEST_USER_A as string); -jest.mock('@/access/AuthenticationService'); +jest.mock('@/access/authentication'); describe('TimeoutModal', () => { diff --git a/ui/tests/components/UHGroupingsInfo.test.tsx b/ui/tests/components/uh-groupings-info.test.tsx similarity index 97% rename from ui/tests/components/UHGroupingsInfo.test.tsx rename to ui/tests/components/uh-groupings-info.test.tsx index a70daa9f..c89f173d 100644 --- a/ui/tests/components/UHGroupingsInfo.test.tsx +++ b/ui/tests/components/uh-groupings-info.test.tsx @@ -1,5 +1,5 @@ import { render, screen } from '@testing-library/react'; -import UHGroupingsInfo from '@/components/UHGroupingsInfo'; +import UHGroupingsInfo from '@/components/uh-groupings-info'; describe('UHGroupings Component', () => { const expectCogs = (size: 'text-[1.2rem]' | 'text-base') => { diff --git a/ui/tests/middleware.test.tsx b/ui/tests/middleware.test.tsx index 6c9cf2e5..51d74916 100644 --- a/ui/tests/middleware.test.tsx +++ b/ui/tests/middleware.test.tsx @@ -1,9 +1,9 @@ import { config, middleware } from '@/middleware'; -import { createMockSession } from './setupJest'; +import { createMockSession } from './setup-jest'; import { NextRequest, NextResponse } from 'next/server'; import IronSession from 'iron-session'; -import User, { AnonymousUser } from '@/access/User'; -import Role from '@/access/Role'; +import User, { AnonymousUser } from '@/access/user'; +import Role from '@/access/role'; const baseUrl = process.env.NEXT_PUBLIC_BASE_URL as string; const testUser: User = JSON.parse(process.env.TEST_USER_A as string); diff --git a/ui/tests/setupJest.ts b/ui/tests/setup-jest.ts similarity index 90% rename from ui/tests/setupJest.ts rename to ui/tests/setup-jest.ts index 186f3753..b11b4b4a 100644 --- a/ui/tests/setupJest.ts +++ b/ui/tests/setup-jest.ts @@ -1,7 +1,7 @@ import '@testing-library/jest-dom'; import { loadEnvConfig } from '@next/env'; import { enableFetchMocks } from 'jest-fetch-mock'; -import User from '@/access/User'; +import User from '@/access/user'; enableFetchMocks(); loadEnvConfig(process.cwd());