-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test: settings page * test: stats page * test: performance page * test: donate view * test: mock calengrade view * test: confirmation view * test: recovery page * test: sign up page * refactor: remove comments and correct import * feat: highcharts acessibility module * fix: signup page as confirmed route --------- Co-authored-by: FusiDaniel <[email protected]>
- Loading branch information
1 parent
85a373d
commit 7bd654f
Showing
40 changed files
with
3,464 additions
and
343 deletions.
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
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
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,17 +1,15 @@ | ||
import { render, screen, userEvent, waitFor } from '@/test-utils'; | ||
import { AppBar } from '.'; | ||
import { user as userMock } from '@/mocks/users'; | ||
import { user as mockedUser } from '@/mocks/users'; | ||
import { useAuth } from '@/stores/useAuth'; | ||
import { HttpResponse, http } from 'msw'; | ||
import { server } from '@/mocks/server'; | ||
|
||
describe('<AppBar />', () => { | ||
const originalUseAuthValue = useAuth.getState(); | ||
beforeEach(() => { | ||
useAuth.setState({ | ||
...originalUseAuthValue, | ||
token: 'token', | ||
user: userMock, | ||
user: mockedUser, | ||
}); | ||
}); | ||
afterEach(() => { | ||
|
@@ -38,23 +36,21 @@ describe('<AppBar />', () => { | |
); | ||
expect(await screen.findByText(/sair/i)).toBeInTheDocument(); | ||
expect( | ||
await screen.findByText(userMock.email.replace(/(.*)@.*/, '$1')), | ||
await screen.findByText(mockedUser.email.replace(/(.*)@.*/, '$1')), | ||
).toBeInTheDocument(); | ||
expect( | ||
screen.getByText( | ||
new RegExp(`^${userMock.email[0]}${userMock.email[1]}$`, 'i'), | ||
new RegExp(`^${mockedUser.email[0]}${mockedUser.email[1]}$`, 'i'), | ||
), | ||
).toBeInTheDocument(); | ||
}); | ||
test('render user initials if user email has two names', async () => { | ||
server.use( | ||
http.get(/.*\/users\/info/, () => | ||
HttpResponse.json({ | ||
...userMock, | ||
email: '[email protected]', | ||
}), | ||
), | ||
); | ||
useAuth.setState({ | ||
user: { | ||
...mockedUser, | ||
email: '[email protected]', | ||
}, | ||
}); | ||
const user = userEvent.setup(); | ||
|
||
render(AppBar); | ||
|
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,51 @@ | ||
import { http, HttpResponse } from 'msw'; | ||
import { user } from './users'; | ||
import { user, userGrades } from './users'; | ||
import { enrollments } from './enrollments'; | ||
import { | ||
usage, | ||
courses, | ||
classes, | ||
overview, | ||
courseNames, | ||
classesPage1, | ||
subjects, | ||
grades, | ||
} from './stats'; | ||
import { historiesGraduations } from './performance'; | ||
|
||
const baseUrl = 'https://api.ufabcnext.com/v1'; | ||
|
||
export const handlers = [ | ||
http.get(`${baseUrl}/users/info`, () => HttpResponse.json(user)), | ||
http.get(`${baseUrl}/enrollments`, () => HttpResponse.json(enrollments)), | ||
http.get(`${baseUrl}/stats/usage`, () => HttpResponse.json(usage)), | ||
http.get(`${baseUrl}/stats/disciplinas/courses`, () => | ||
HttpResponse.json(courses), | ||
), | ||
http.get(`${baseUrl}/stats/disciplinas`, ({ request }) => { | ||
const url = new URL(request.url); | ||
if (url.searchParams.get('page') === '1') { | ||
return HttpResponse.json(classesPage1); | ||
} | ||
return HttpResponse.json(classes); | ||
}), | ||
http.get(`${baseUrl}/stats/disciplinas/overview`, () => | ||
HttpResponse.json(overview), | ||
), | ||
http.get(`${baseUrl}/stats/disciplinas/disciplines`, () => | ||
HttpResponse.json(subjects), | ||
), | ||
http.get(`${baseUrl}/histories/courses`, () => | ||
HttpResponse.json(courseNames), | ||
), | ||
http.get(`${baseUrl}/users/me/grades`, () => HttpResponse.json(userGrades)), | ||
http.get(`${baseUrl}/stats/grades`, () => HttpResponse.json(grades)), | ||
http.get(`${baseUrl}/historiesGraduations`, () => | ||
HttpResponse.json(historiesGraduations), | ||
), | ||
http.delete(`${baseUrl}/users/me/delete`, () => HttpResponse.json({})), | ||
http.post(`${baseUrl}/account/confirm`, () => HttpResponse.json({})), | ||
http.post(`${baseUrl}/users/me/recover`, () => HttpResponse.json({})), | ||
http.post(`${baseUrl}/users/me/resend`, () => HttpResponse.json({})), | ||
http.put(`${baseUrl}/users/complete`, () => HttpResponse.json({})), | ||
]; |
Oops, something went wrong.