From 4803767c74a263f3c6c3d381ecf1e973275227ff Mon Sep 17 00:00:00 2001 From: Cody Epstein Date: Wed, 30 Oct 2024 10:27:19 -0700 Subject: [PATCH 1/2] change empty leagues check to array with empty string --- utils/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) => { From 5735aa3426fd54f4046e87e19992a6d95a6d9e99 Mon Sep 17 00:00:00 2001 From: Cody Epstein Date: Wed, 30 Oct 2024 11:06:02 -0700 Subject: [PATCH 2/2] modify test for getUserLeagues --- utils/utils.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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([]); });