mock additional k5 requests
refs LS-3017 flag=none These warnings were not causing tests to fail for some reason. I wasn't able to pin the reason down, my suspicion is that fetch-mock uses an internal logging mechanism. test plan: - run `yarn test:jest ui/features/k5_` - there should be no console output regarding unmatched requests qa risk: low Change-Id: I4e8eb876571ca74eb0b2edef6a62640387f15a15 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286391 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Omar Soto-Fortuño <omar.soto@instructure.com> QA-Review: Omar Soto-Fortuño <omar.soto@instructure.com> Product-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
This commit is contained in:
parent
c8d8efe784
commit
811f3b838f
|
@ -109,15 +109,7 @@ const ignoredWarnings = [
|
|||
/Exactly one focusable child is required/,
|
||||
/Please update the following components: %s/,
|
||||
/shared_brand_configs.* not called/,
|
||||
/value provided is not in a recognized RFC2822 or ISO format/,
|
||||
// the following warnings were not appropriately failing tests upon console.warn
|
||||
// filtered from output, will need to be investigated within /ui/features/k5_*
|
||||
/Unmatched GET to \/api\/v1\/announcements/,
|
||||
/Unmatched GET to \/api\/v1\/users\/\d+\/calendar_events/,
|
||||
/Unmatched GET to \/api\/v1\/courses\/\d+\/assignment_groups/,
|
||||
/Unmatched GET to \/api\/v1\/courses\/\d+\/enrollments/,
|
||||
/Unmatched GET to \/api\/v1\/courses\/\d+\/assignment_groups/
|
||||
// end k5 console.warn investigation
|
||||
/value provided is not in a recognized RFC2822 or ISO format/
|
||||
]
|
||||
global.console = {
|
||||
log: console.log,
|
||||
|
|
|
@ -231,6 +231,8 @@ describe('GradesPage', () => {
|
|||
JSON.stringify(MOCK_ASSIGNMENT_GROUPS)
|
||||
)
|
||||
fetchMock.get(`${ENROLLMENTS_URL}&grading_period_id=2`, JSON.stringify(MOCK_ENROLLMENTS))
|
||||
fetchMock.get(ENROLLMENTS_URL, JSON.stringify(MOCK_ENROLLMENTS))
|
||||
fetchMock.get(ASSIGNMENT_GROUPS_URL, JSON.stringify(MOCK_ASSIGNMENT_GROUPS))
|
||||
})
|
||||
|
||||
it('shows a grading period select when grading periods are returned', async () => {
|
||||
|
|
|
@ -134,6 +134,7 @@ const OBSERVER_ASSIGNMENT_GROUPS_URL = encodeURI(
|
|||
)
|
||||
const ENROLLMENTS_URL = '/api/v1/courses/30/enrollments?user_id=1'
|
||||
const OBSERVER_ENROLLMENTS_URL = '/api/v1/courses/30/enrollments?user_id=1&include=observed_users'
|
||||
const ANNOUNEMENTS_URL_REGEX = /\/api\/v1\/announcements\.*/
|
||||
|
||||
const GROUPS_URL = encodeURI(
|
||||
'/api/v1/courses/30/groups?include[]=users&include[]=group_category&include[]=permissions&include_inactive_users=true'
|
||||
|
@ -184,6 +185,7 @@ beforeEach(() => {
|
|||
fetchMock.get(GRADING_PERIODS_URL, JSON.stringify(MOCK_GRADING_PERIODS_EMPTY))
|
||||
fetchMock.get(ASSIGNMENT_GROUPS_URL, JSON.stringify(MOCK_ASSIGNMENT_GROUPS))
|
||||
fetchMock.get(ENROLLMENTS_URL, JSON.stringify(MOCK_ENROLLMENTS))
|
||||
fetchMock.get(ANNOUNEMENTS_URL_REGEX, JSON.stringify([]))
|
||||
fakeXhrServer.respondWith('GET', GROUPS_URL, [
|
||||
200,
|
||||
{'Content-Type': 'application/json'},
|
||||
|
|
|
@ -280,6 +280,7 @@ beforeEach(() => {
|
|||
JSON.stringify({status: 'ok'})
|
||||
)
|
||||
fetchMock.put(/\/api\/v1\/users\/\d+\/colors\.*/, {status: 200, body: []})
|
||||
fetchMock.get(/\/api\/v1\/users\/\d+\/calendar_events\.*/, JSON.stringify([]))
|
||||
global.ENV = defaultEnv
|
||||
})
|
||||
afterEach(() => {
|
||||
|
|
Loading…
Reference in New Issue