Skip to content

Commit

Permalink
Add test to cover the presence of organization_public_id in dashboard…
Browse files Browse the repository at this point in the history
… config
  • Loading branch information
acelaya authored and marcospri committed Jul 31, 2024
1 parent 1e76ef7 commit 0c1d27f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ export default function DashboardActivityFilters({
const courses = useAPIFetch<{ courses: Course[] }>(routes.courses, {
h_userid: selectedStudentIds,
assignment_id: selectedAssignmentIds,
public_id: dashboard.organization_public_id
public_id: dashboard.organization_public_id,
});
const assignments = useAPIFetch<{ assignments: Assignment[] }>(
routes.assignments,
{
h_userid: selectedStudentIds,
course_id: selectedCourseIds,
public_id: dashboard.organization_public_id
public_id: dashboard.organization_public_id,
},
);
const students = useAPIFetch<{ students: Student[] }>(routes.students, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,18 +272,21 @@ describe('DashboardActivityFilters', () => {
assert.calledWith(fakeUseAPIFetch.getCall(0), '/api/dashboard/courses', {
h_userid: selectedStudentIds,
assignment_id: selectedAssignmentIds,
public_id: undefined,
});
assert.calledWith(
fakeUseAPIFetch.getCall(1),
'/api/dashboard/assignments',
{
h_userid: selectedStudentIds,
course_id: selectedCourseIds,
public_id: undefined,
},
);
assert.calledWith(fakeUseAPIFetch.getCall(2), '/api/dashboard/students', {
assignment_id: selectedAssignmentIds,
course_id: selectedCourseIds,
public_id: undefined,
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,23 +178,23 @@ describe('OrganizationActivity', () => {
h_userid: ['123', '456'],
assignment_id: [],
course_id: [],
public_id: [],
public_id: undefined,
});

updateFilter('onAssignmentsChange', ['1', '2']);
assertCoursesFetched({
h_userid: [],
assignment_id: ['1', '2'],
course_id: [],
public_id: [],
public_id: undefined,
});

updateFilter('onCoursesChange', ['3', '8', '9']);
assertCoursesFetched({
h_userid: [],
assignment_id: [],
course_id: ['3', '8', '9'],
public_id: [],
public_id: undefined,
});
});

Expand All @@ -209,6 +209,7 @@ describe('OrganizationActivity', () => {
h_userid: [],
assignment_id: [],
course_id: [],
public_id: undefined,
});
});

Expand Down

0 comments on commit 0c1d27f

Please sign in to comment.