diff --git a/components/AlertTItle/AlertTitle.test.tsx b/components/AlertTItle/AlertTitle.test.tsx new file mode 100644 index 00000000..32010c72 --- /dev/null +++ b/components/AlertTItle/AlertTitle.test.tsx @@ -0,0 +1,10 @@ +import React from 'react'; +import { render } from '@testing-library/react'; +import { AlertTitle } from './AlertTitle'; + +describe('AlertTitle', () => { + it('renders the title text', () => { + const { getByText } = render(); + expect(getByText('Test Title')).toBeInTheDocument(); + }); +}); diff --git a/utils/utils.test.ts b/utils/utils.test.ts index 1c471924..c1633b16 100644 --- a/utils/utils.test.ts +++ b/utils/utils.test.ts @@ -207,14 +207,14 @@ describe('utils', () => { }); }); - xdescribe('getUserLeagues', () => { + describe('getUserLeagues', () => { it('should return the list of leagues the user is a part of', async () => { (getCurrentLeague as jest.Mock).mockResolvedValue(mockLeague); const result = await getUserLeagues(mockUserData.leagues); expect(result).toStrictEqual([mockLeague]); }); it('should return an empty array if the user has no leagues', async () => { - const result = await getUserLeagues([]); + const result = await getUserLeagues(['']); expect(getCurrentLeague).toHaveBeenCalledTimes(0); expect(result).toStrictEqual([]); }); diff --git a/utils/utils.ts b/utils/utils.ts index ca28a1da..9ff84691 100644 --- a/utils/utils.ts +++ b/utils/utils.ts @@ -127,7 +127,7 @@ export const parseUserPick = ( export const getUserLeagues = async ( leagues: IUser['leagues'], ): Promise => { - if (!leagues || leagues.length === 0) { + if (!leagues || leagues[0] === '') { return []; } const userLeagues = leagues.map((league) => {