Skip to content
Open
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
19 changes: 19 additions & 0 deletions test/test-crawler.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,25 @@ const mockFetch = async (url, options) => {
assert.strictEqual(courseData.assignments[0].title, 'Quiz 1');
assert.strictEqual(courseData.assignments[0].description, 'Recall organelles');

// Test 2.5: Missing Error Path Test for crawlCanvasCourse
let caughtError1 = false;
try {
await crawlCanvasCourse(null, '12345', mockFetch);
} catch (err) {
caughtError1 = true;
assert.strictEqual(err.message, 'Canvas origin and courseId are required for course crawling.');
}
assert.ok(caughtError1, 'Should throw error when origin is missing');

let caughtError2 = false;
try {
await crawlCanvasCourse('https://canvas.instructure.com', null, mockFetch);
} catch (err) {
caughtError2 = true;
assert.strictEqual(err.message, 'Canvas origin and courseId are required for course crawling.');
}
assert.ok(caughtError2, 'Should throw error when courseId is missing');

// Test 3: Demo Course Audit Fallback
const demoResult = getDemoCourseAuditResult({ title: 'Biology 101: Cell Systems' });
assert.ok(demoResult.summary.keyTakeaway.includes('Course-Level Demo'));
Expand Down
2 changes: 1 addition & 1 deletion test/test-doctor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ DOCTOR_CMD="$MOCK_IDSTACK_DIR/bin/idstack-doctor"
# mock we drop in. `claude` is absent unless a test installs it.
MOCK_BIN="$TEST_ROOT/bin"
mkdir -p "$MOCK_BIN"
for _c in bash sh env command dirname echo grep head python3 readlink sed tr awk cat ls rm mkdir ln chmod mktemp printf sort wc basename find touch cp; do
for _c in bash sh env command dirname echo grep head python3 readlink sed tr awk cat ls rm mkdir ln chmod mktemp printf sort wc basename find touch cp cut; do
_p=$(command -v "$_c" 2>/dev/null) && ln -sf "$_p" "$MOCK_BIN/$_c"
done
export PATH="$MOCK_BIN"
Expand Down
Loading