feat: add header logo, fix teacher field, compact program, date range, total under UNITS
This commit is contained in:
+18
-1
@@ -5,7 +5,7 @@ const os = require('node:os');
|
||||
const path = require('node:path');
|
||||
const { execFileSync } = require('node:child_process');
|
||||
global.PDFLib = require('pdf-lib');
|
||||
const { buildStudyLoadPdf } = require('../pdf.js');
|
||||
const { buildStudyLoadPdf, compactProgram, deriveDateRange } = require('../pdf.js');
|
||||
|
||||
const sampleData = {
|
||||
header: {
|
||||
@@ -49,4 +49,21 @@ test('buildStudyLoadPdf returns valid PDF bytes', async () => {
|
||||
const text = extractPdfText(bytes);
|
||||
assert.ok(text.includes('CIS 2101'), 'PDF text should contain course code CIS 2101');
|
||||
assert.ok(text.includes("STUDENT'S STUDY LOAD"), 'PDF text should contain the title');
|
||||
assert.ok(text.includes('CHRISTIAN MADERAZO'), 'PDF text should contain the teacher');
|
||||
assert.ok(text.includes('BS IT'), 'PDF text should contain the compacted program');
|
||||
});
|
||||
|
||||
test('compactProgram shortens degree names', () => {
|
||||
assert.strictEqual(compactProgram('BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY'), 'BS IT');
|
||||
assert.strictEqual(compactProgram('BACHELOR OF SCIENCE IN COMPUTER SCIENCE'), 'BS CS');
|
||||
assert.strictEqual(compactProgram('BACHELOR OF ARTS IN POLITICAL SCIENCE'), 'AB PS');
|
||||
assert.strictEqual(compactProgram('BACHELOR OF SCIENCE IN ACCOUNTANCY'), 'BS Accountancy');
|
||||
assert.strictEqual(compactProgram('UNKNOWN PROGRAM'), 'UNKNOWN PROGRAM');
|
||||
});
|
||||
|
||||
test('deriveDateRange maps semesters', () => {
|
||||
assert.strictEqual(deriveDateRange('1ST Semester 2026'), 'AUGUST - JANUARY');
|
||||
assert.strictEqual(deriveDateRange('2ND Semester 2026'), 'JANUARY - MAY');
|
||||
assert.strictEqual(deriveDateRange('Summer 2026'), 'JUNE - JULY');
|
||||
assert.strictEqual(deriveDateRange(''), '');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user