-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alex/implement admin league operation #489
Merged
Merged
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
18970b1
update package.json to latest release version
chris-nowicki 8bafcb7
Merge branch 'develop' into alex/implement-admin-league-operation
alexappleget ba09e35
Fix: Added in functionality to create a new league.
alexappleget 20072fe
Fix: Added in functionality for deleting a league.
alexappleget 3357249
Fix: Changed function name for creating a new league in page.tsx
alexappleget 2b443a1
Fix: Added the getCurrentLeague function to the page file for grabbin…
alexappleget 08095de
Fix: Handled param for handleGetLeague().
alexappleget 033c33a
Fix: added <tbody> parent element to data table because of hydration …
alexappleget 697a7af
Fix: Adding in data table for league data.
alexappleget 01cd943
Merge branch 'develop' into alex/implement-admin-league-operation
alexappleget 1fe5867
Fix: Cleaned up page.tsx for Admin League Operations.
alexappleget db19193
Merge remote-tracking branch 'origin/develop' into alex/implement-adm…
alexappleget da1d086
Nit Fix: Alphabetized the column headers
alexappleget 00bab8c
Fix: Cleaned up page.tsx and added in <TableData /> component.
alexappleget d5f1eb7
Fix: Deleted apiFunctions and interface props as they aren't within t…
alexappleget 6ae8dcd
Fix: Cleaned up column keys/headers for LeagueHeader for readability.
alexappleget 80a8505
Fix: Fetched user league data and tweaked table column functionality …
alexappleget 0036b06
Fix: Creating apiFunction to grab all entries in the leagues a user i…
alexappleget 13d2a75
Fix: updated function to grab entries length.
alexappleget 8d900d7
Fix: Got it working to show total entries in each league.
alexappleget 7a0d5f4
Fix: Got data table to render total entries and entries alive. Also s…
alexappleget a3b6742
Fix: Deleted the utils function I created.
alexappleget f31c3b9
Fix: created interface file for new column props.
alexappleget 5b7e609
Fix: alphabetized combinedData props.
alexappleget 2d93d72
Fix: alphabetized things that I can in the page.tsx file for admin le…
alexappleget 62873d3
Fix: alphabetized imports in TableColumns
alexappleget 9939f20
Fix: creating api test for the getAllLeagueEntries();
alexappleget d621df0
Fix: fixed testing for getAllLeagueEntries()
alexappleget 1559c7d
Fix: fixed testing
alexappleget 798ff07
Fix: made page.tsx testing that passes but has an error.
alexappleget fea5080
Merge remote-tracking branch 'origin/develop' into alex/implement-adm…
alexappleget a0c3859
Fix: deleted comment code
alexappleget 4017afd
Merge remote-tracking branch 'origin/develop' into alex/implement-adm…
alexappleget 8f8258a
Fix: created test for getAllLeagueEntries() apiFunction
alexappleget d2f88e4
Fix: Fixed api function testing for getAllLeagueEntries.
alexappleget a894326
Fix: created testing for admin league page
alexappleget 1f6048e
Fix: added sorting code
alexappleget 6572029
Fix: got rid of trycatch{} block.
alexappleget 2e8b5ae
Fix: handled comment by changing console.error to throw new Error in …
alexappleget 8f62f60
Merge remote-tracking branch 'origin/develop' into alex/implement-adm…
alexappleget 36f4803
Merge remote-tracking branch 'origin/develop' into alex/implement-adm…
alexappleget 6a7650a
Fix: Handled Shashi's comment about apiFunction error code.
alexappleget adffce8
Merge remote-tracking branch 'origin/develop' into alex/implement-adm…
alexappleget fa72e54
Fix: changed divs to p tags.
alexappleget d2aa3b2
Merge remote-tracking branch 'origin/develop' into alex/implement-adm…
alexappleget 31a41c4
Fix: changed <p> tags to <span> tags
alexappleget 7436de1
Merge remote-tracking branch 'origin/develop' into alex/implement-adm…
alexappleget 3134021
Fix: changed getAllLeagueEntries apiFunction name to getTotalEntries
alexappleget f301ee9
Fix: fixed testing
alexappleget b26a582
Fix: changed test name to match new function name
alexappleget 7730fb5
Merge remote-tracking branch 'origin/develop' into alex/implement-adm…
alexappleget File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,46 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import { render, screen, waitFor } from '@testing-library/react'; | ||
import AdminLeagues from './page'; | ||
import { getUserLeagues } from '@/utils/utils'; | ||
import { getTotalEntries } from '@/api/apiFunctions'; | ||
|
||
jest.mock('@/store/dataStore', () => ({ | ||
useDataStore: jest.fn(() => ({ | ||
user: { | ||
documentId: '123', | ||
id: '1234', | ||
email: '[email protected]', | ||
leagues: ['league1', 'league2'], | ||
}, | ||
})), | ||
})); | ||
|
||
jest.mock('@/utils/utils', () => ({ | ||
getUserLeagues: jest.fn(() => Promise.resolve([])), | ||
cn: jest.fn(), | ||
})); | ||
|
||
jest.mock('@/api/apiFunctions', () => ({ | ||
getTotalEntries: jest.fn(), | ||
})); | ||
|
||
describe('AdminLeagues', () => { | ||
it('should render the AdminLeagues page with LeagueCard components', () => { | ||
render(<AdminLeagues />); | ||
const leagueCards = screen.getAllByTestId('LeagueCard'); | ||
expect(leagueCards.length).toBe(3); | ||
render(<AdminLeagues />); | ||
|
||
const mockGetUserLeagues = getUserLeagues as jest.Mock; | ||
const mockGetTotalEntries = getTotalEntries as jest.Mock; | ||
|
||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
it('should render the League data table component', async () => { | ||
mockGetTotalEntries.mockResolvedValue([]); | ||
|
||
mockGetUserLeagues.mockResolvedValue([]); | ||
|
||
await waitFor(() => { | ||
const leagueTable = screen.getByTestId('data-table'); | ||
expect(leagueTable).toBeInTheDocument(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) Gridiron Survivor. | ||
// Licensed under the MIT License. | ||
|
||
import { ILeague } from '@/api/apiFunctions.interface'; | ||
|
||
export interface IEntryWithLeague extends ILeague { | ||
aliveEntries: number; | ||
totalEntries: number; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Future task, but we'll optimize this into 1 iteration.