Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const makeAppContextMock = () => ({
deleteCommentBankItem: vi.fn(),
});
vi.mock('../../../context/AppContext', () => ({
useApp: () => makeAppContextMock(),
useRoster: () => makeAppContextMock(),
useAuthoring: () => makeAppContextMock(),
useAssessment: () => makeAppContextMock(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const makeAppContextMock = () => ({
deleteCommentBankItem: vi.fn(),
});
vi.mock('../../../context/AppContext', () => ({
useApp: () => makeAppContextMock(),
useRoster: () => makeAppContextMock(),
useAuthoring: () => makeAppContextMock(),
useAssessment: () => makeAppContextMock(),
Expand Down
1 change: 0 additions & 1 deletion src/components/Layout/__tests__/Sidebar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const makeAppContextMock = () => ({
students: [],
});
vi.mock('../../../context/AppContext', () => ({
useApp: () => makeAppContextMock(),
useRoster: () => makeAppContextMock(),
useAuthoring: () => makeAppContextMock(),
useAssessment: () => makeAppContextMock(),
Expand Down
1 change: 0 additions & 1 deletion src/components/Layout/__tests__/Topbar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const makeAppContextMock = () => ({
essayAssignments: [],
});
vi.mock('../../../context/AppContext', () => ({
useApp: () => makeAppContextMock(),
useRoster: () => makeAppContextMock(),
useAuthoring: () => makeAppContextMock(),
useAssessment: () => makeAppContextMock(),
Expand Down
1 change: 0 additions & 1 deletion src/components/Students/__tests__/CsvImportModal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
}),
}));

let parseImpl: (file: File, opts: any) => void = (_file, opts) => {

Check warning on line 30 in src/components/Students/__tests__/CsvImportModal.test.tsx

View workflow job for this annotation

GitHub Actions / Type-check, Lint & Test

Unexpected any. Specify a different type
opts.complete({ data: [{ Name: 'Alice Anderson', Email: 'alice@school.com', Class: 'Class A' }] });
};

vi.mock('papaparse', () => ({
default: {
parse: vi.fn((file: File, opts: any) => parseImpl(file, opts)),

Check warning on line 36 in src/components/Students/__tests__/CsvImportModal.test.tsx

View workflow job for this annotation

GitHub Actions / Type-check, Lint & Test

Unexpected any. Specify a different type
},
}));

Expand All @@ -54,7 +54,6 @@
settings: {},
});
vi.mock('../../../context/AppContext', () => ({
useApp: () => makeAppContextMock(),
useRoster: () => makeAppContextMock(),
useAuthoring: () => makeAppContextMock(),
useAssessment: () => makeAppContextMock(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const makeAppContextMock = () => ({
fetchMyStudentFlashcardDecks,
});
vi.mock('../../../context/AppContext', () => ({
useApp: () => makeAppContextMock(),
useRoster: () => makeAppContextMock(),
useAuthoring: () => makeAppContextMock(),
useAssessment: () => makeAppContextMock(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ vi.mock('react-i18next', () => ({

const makeAppContextMock = () => ({ settings: {}, addQuestionBankItem: vi.fn() });
vi.mock('../../../context/AppContext', () => ({
useApp: () => makeAppContextMock(),
useRoster: () => makeAppContextMock(),
useAuthoring: () => makeAppContextMock(),
useAssessment: () => makeAppContextMock(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ const makeAppContextMock = () => ({
bulkUpdateQuestionBankItems,
});
vi.mock('../../../context/AppContext', () => ({
useApp: () => makeAppContextMock(),
useRoster: () => makeAppContextMock(),
useAuthoring: () => makeAppContextMock(),
useAssessment: () => makeAppContextMock(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ vi.mock('react-i18next', () => ({

const makeAppContextMock = () => ({ settings: {}, addQuestionBankItem: vi.fn() });
vi.mock('../../../context/AppContext', () => ({
useApp: () => makeAppContextMock(),
useRoster: () => makeAppContextMock(),
useAuthoring: () => makeAppContextMock(),
useAssessment: () => makeAppContextMock(),
Expand Down
1 change: 0 additions & 1 deletion src/components/Tests/__tests__/QuestionEditor.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ vi.mock('react-i18next', () => ({

const makeAppContextMock = () => ({ settings: {} });
vi.mock('../../../context/AppContext', () => ({
useApp: () => makeAppContextMock(),
useRoster: () => makeAppContextMock(),
useAuthoring: () => makeAppContextMock(),
useAssessment: () => makeAppContextMock(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const makeAppContextMock = () => ({
saveTestAssignment: mockSaveTestAssignment,
});
vi.mock('../../../context/AppContext', () => ({
useApp: () => makeAppContextMock(),
useRoster: () => makeAppContextMock(),
useAuthoring: () => makeAppContextMock(),
useAssessment: () => makeAppContextMock(),
Expand Down
1 change: 0 additions & 1 deletion src/components/__tests__/GlobalSearch.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { MemoryRouter } from 'react-router-dom';
import { DEFAULT_FORMAT } from '../../types';
import type { AppSettings, Rubric, Student, Class } from '../../types';

Check warning on line 6 in src/components/__tests__/GlobalSearch.test.tsx

View workflow job for this annotation

GitHub Actions / Type-check, Lint & Test

'AppSettings' is defined but never used. Allowed unused vars must match /^_/u

const mockNavigate = vi.fn();

Expand Down Expand Up @@ -53,7 +53,6 @@
};

vi.mock('../../context/AppContext', () => ({
useApp: () => mockAppValue,
useRoster: () => mockAppValue,
useAuthoring: () => mockAppValue,
useAssessment: () => mockAppValue,
Expand Down
1 change: 0 additions & 1 deletion src/components/__tests__/StandardsPickerModal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const makeAppContextMock = () => ({
isFavoriteStandard: mockIsFavorite,
});
vi.mock('../../context/AppContext', () => ({
useApp: () => makeAppContextMock(),
useRoster: () => makeAppContextMock(),
useAuthoring: () => makeAppContextMock(),
useAssessment: () => makeAppContextMock(),
Expand Down
1 change: 0 additions & 1 deletion src/components/__tests__/components.smoke.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
isFavoriteStandard: vi.fn(() => false),
});
vi.mock('../../context/AppContext', () => ({
useApp: () => makeAppContextMock(),
useRoster: () => makeAppContextMock(),
useAuthoring: () => makeAppContextMock(),
useAssessment: () => makeAppContextMock(),
Expand Down Expand Up @@ -72,7 +71,7 @@

vi.mock('papaparse', () => ({
default: {
parse: vi.fn((_file: File, opts: any) => {

Check warning on line 74 in src/components/__tests__/components.smoke.test.tsx

View workflow job for this annotation

GitHub Actions / Type-check, Lint & Test

Unexpected any. Specify a different type
opts.complete({ data: [{ Name: 'Alice', Class: 'A' }] });
}),
},
Expand Down
1 change: 0 additions & 1 deletion src/components/__tests__/components.untested.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ const makeAppContextMock = () => ({
dismissMigrationPrompt: mockDismissMigrationPrompt,
});
vi.mock('../../context/AppContext', () => ({
useApp: () => makeAppContextMock(),
useRoster: () => makeAppContextMock(),
useAuthoring: () => makeAppContextMock(),
useAssessment: () => makeAppContextMock(),
Expand Down
36 changes: 18 additions & 18 deletions src/context/AppContext.extended.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { ReactNode } from 'react';
import { renderHook, act } from '@testing-library/react';
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { AppProvider, useApp } from './AppContext';
import { AppProvider, useRoster, useAuthoring, useAssessment } from './AppContext';
import type { Rubric, RubricVersion } from '../types';
import { DEFAULT_FORMAT } from '../types';

Expand Down Expand Up @@ -117,7 +117,7 @@ describe('AppContext — extended actions', () => {
// ─── Students & Classes ───────────────────────────────────────────────────

it('adds and deletes a student', () => {
const { result } = renderHook(() => useApp(), { wrapper });
const { result } = renderHook(() => useRoster(), { wrapper });
let id: string;
act(() => {
const s = result.current.addStudent({ name: 'Bob', classId: 'c1' });
Expand All @@ -131,7 +131,7 @@ describe('AppContext — extended actions', () => {
});

it('updates a student', () => {
const { result } = renderHook(() => useApp(), { wrapper });
const { result } = renderHook(() => useRoster(), { wrapper });
act(() => {
result.current.addStudent({ name: 'Bob', classId: 'c1' });
});
Expand All @@ -142,7 +142,7 @@ describe('AppContext — extended actions', () => {
});

it('adds, updates, and deletes a class', () => {
const { result } = renderHook(() => useApp(), { wrapper });
const { result } = renderHook(() => useRoster(), { wrapper });
act(() => {
result.current.addClass({ name: 'Class A' });
});
Expand All @@ -158,7 +158,7 @@ describe('AppContext — extended actions', () => {
});

it('deleteClass with deleteStudents=true removes students in that class', () => {
const { result } = renderHook(() => useApp(), { wrapper });
const { result } = renderHook(() => useRoster(), { wrapper });
act(() => {
result.current.addClass({ name: 'Class A' });
});
Expand All @@ -176,7 +176,7 @@ describe('AppContext — extended actions', () => {
// ─── Self Assessments ─────────────────────────────────────────────────────

it('saves and deletes a self assessment', () => {
const { result } = renderHook(() => useApp(), { wrapper });
const { result } = renderHook(() => useAssessment(), { wrapper });
const sa = { id: 'sa1', rubricId: 'r1', studentId: 's1', ratings: [], submittedAt: '2024-01-01' };
act(() => {
result.current.saveSelfAssessment(sa);
Expand All @@ -191,7 +191,7 @@ describe('AppContext — extended actions', () => {
// ─── Speaking Sessions ────────────────────────────────────────────────────

it('saves and updates a speaking session', () => {
const { result } = renderHook(() => useApp(), { wrapper });
const { result } = renderHook(() => useAssessment(), { wrapper });
const session = {
id: 'ss1',
rubricId: 'r1',
Expand All @@ -211,7 +211,7 @@ describe('AppContext — extended actions', () => {
});

it('deletes a speaking session', () => {
const { result } = renderHook(() => useApp(), { wrapper });
const { result } = renderHook(() => useAssessment(), { wrapper });
const session = {
id: 'ss1',
rubricId: 'r1',
Expand All @@ -232,7 +232,7 @@ describe('AppContext — extended actions', () => {
// ─── Rubric Versioning ────────────────────────────────────────────────────

it('saves a rubric version', async () => {
const { result } = renderHook(() => useApp(), { wrapper });
const { result } = renderHook(() => useAuthoring(), { wrapper });
act(() => {
result.current.addRubric(makeRubric());
});
Expand All @@ -246,7 +246,7 @@ describe('AppContext — extended actions', () => {
});

it('restores a rubric version', async () => {
const { result } = renderHook(() => useApp(), { wrapper });
const { result } = renderHook(() => useAuthoring(), { wrapper });
act(() => {
result.current.addRubric(makeRubric());
});
Expand All @@ -269,7 +269,7 @@ describe('AppContext — extended actions', () => {
});

it('saveRubricVersion does nothing for unknown rubricId', async () => {
const { result } = renderHook(() => useApp(), { wrapper });
const { result } = renderHook(() => useAuthoring(), { wrapper });
await act(async () => {
await result.current.saveRubricVersion('unknown');
});
Expand All @@ -278,7 +278,7 @@ describe('AppContext — extended actions', () => {
});

it('restoreRubricVersion does nothing for unknown rubricId', () => {
const { result } = renderHook(() => useApp(), { wrapper });
const { result } = renderHook(() => useAuthoring(), { wrapper });
act(() => {
result.current.restoreRubricVersion('unknown', makeRubric() as Rubric);
});
Expand All @@ -288,7 +288,7 @@ describe('AppContext — extended actions', () => {
// ─── Rubric Snapshot Sync ─────────────────────────────────────────────────

it('syncRubricSnapshot updates student rubrics with new criteria', () => {
const { result } = renderHook(() => useApp(), { wrapper });
const { result } = renderHook(() => ({ ...useRoster(), ...useAuthoring() }), { wrapper });
act(() => {
result.current.addRubric(makeRubric());
});
Expand Down Expand Up @@ -319,7 +319,7 @@ describe('AppContext — extended actions', () => {
// ─── Soft-delete grades (Phase 15.3) ─────────────────────────────────────

it('deleteStudentRubric soft-deletes a solo grade and restoreStudentRubric brings it back', () => {
const { result } = renderHook(() => useApp(), { wrapper });
const { result } = renderHook(() => ({ ...useRoster(), ...useAuthoring() }), { wrapper });
act(() => {
result.current.addRubric(makeRubric());
});
Expand Down Expand Up @@ -347,7 +347,7 @@ describe('AppContext — extended actions', () => {
});

it('deleteStudentRubric with scope "group" soft-deletes every sibling sharing groupId', () => {
const { result } = renderHook(() => useApp(), { wrapper });
const { result } = renderHook(() => ({ ...useRoster(), ...useAuthoring() }), { wrapper });
act(() => {
result.current.addRubric(makeRubric());
});
Expand All @@ -370,7 +370,7 @@ describe('AppContext — extended actions', () => {
});

it('deleteStudentRubric with scope "student" only removes the target and detaches it from the group', () => {
const { result } = renderHook(() => useApp(), { wrapper });
const { result } = renderHook(() => ({ ...useRoster(), ...useAuthoring() }), { wrapper });
act(() => {
result.current.addRubric(makeRubric());
});
Expand Down Expand Up @@ -398,7 +398,7 @@ describe('AppContext — extended actions', () => {
// ─── Vocabulary Items ─────────────────────────────────────────────────────

it('adds, updates, and deletes vocabulary items', () => {
const { result } = renderHook(() => useApp(), { wrapper });
const { result } = renderHook(() => useAuthoring(), { wrapper });
act(() => {
result.current.addRubric(makeRubric());
});
Expand All @@ -425,7 +425,7 @@ describe('AppContext — extended actions', () => {
// ─── Analysis Results ─────────────────────────────────────────────────────

it('saves and deletes analysis results', () => {
const { result } = renderHook(() => useApp(), { wrapper });
const { result } = renderHook(() => useAssessment(), { wrapper });
const ar = {
id: 'ar1',
studentId: 's1',
Expand Down
Loading
Loading