You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dianshang-qianduan/tests/training-outcome-pdf.static...

26 lines
1.3 KiB
JavaScript

const assert = require("assert");
const fs = require("fs");
const path = require("path");
const root = path.resolve(__dirname, "..");
const pdfExporter = fs.readFileSync(path.join(root, "src/utils/trainingOutcomePdf.js"), "utf8");
const toolbar = fs.readFileSync(path.join(root, "src/views/components/TrainingTaskToolbar.vue"), "utf8");
assert.match(pdfExporter, /export async function exportTrainingOutcomePdf/);
assert.match(pdfExporter, /export function collectTrainingOutcomeDetails/);
assert.match(pdfExporter, /function tableData/);
assert.match(pdfExporter, /training-outcome-pdf__table/);
assert.match(pdfExporter, /html2canvas/);
assert.match(pdfExporter, /new jsPDF/);
assert.match(pdfExporter, /import \{ saveAs \} from "file-saver"/);
assert.match(pdfExporter, /pdf\.output\("blob"\)/);
assert.match(pdfExporter, /saveAs\(pdfBlob/);
for (const section of ["实训背景", "实训目标", "实训要求", "实训步骤与学生作答", "步骤内容", "学生作答"]) {
assert.match(pdfExporter, new RegExp(section));
}
assert.match(toolbar, /@click="exportCurrentTrainingOutcome"/);
assert.match(toolbar, /exportTrainingOutcomePdf/);
assert.match(toolbar, /getStudentTrainingAnswer/);
assert.match(toolbar, /collectTrainingOutcomeDetails/);
console.log("training outcome PDF static checks passed");