revert demo10.js, fix paragraph tests

This commit is contained in:
ilmar
2018-04-10 10:25:12 +03:00
parent 50bee30799
commit ae43137906
2 changed files with 15 additions and 15 deletions

View File

@ -67,7 +67,7 @@ const experiences = [
company: { company: {
name: "Soundmouse", name: "Soundmouse",
}, },
} },
]; ];
const education = [ const education = [
@ -96,7 +96,7 @@ const education = [
endDate: { endDate: {
year: 2012, year: 2012,
}, },
} },
]; ];
const skills = [ const skills = [
@ -111,14 +111,14 @@ const skills = [
}, },
{ {
name: "NodeJS", name: "NodeJS",
} },
]; ];
const achievements = [ const achievements = [
{ {
issuer: "Oracle", issuer: "Oracle",
name: "Oracle Certified Expert", name: "Oracle Certified Expert",
} },
]; ];
class DocumentCreator { class DocumentCreator {
@ -135,7 +135,7 @@ class DocumentCreator {
for (const education of educations) { for (const education of educations) {
document.addParagraph( document.addParagraph(
this.createInstitutionHeader(education.schoolName, `${education.startDate.year} - ${education.endDate.year}`) this.createInstitutionHeader(education.schoolName, `${education.startDate.year} - ${education.endDate.year}`),
); );
document.addParagraph(this.createRoleText(`${education.fieldOfStudy} - ${education.degree}`)); document.addParagraph(this.createRoleText(`${education.fieldOfStudy} - ${education.degree}`));
@ -151,8 +151,8 @@ class DocumentCreator {
document.addParagraph( document.addParagraph(
this.createInstitutionHeader( this.createInstitutionHeader(
position.company.name, position.company.name,
this.createPositionDateText(position.startDate, position.endDate, position.isCurrent) this.createPositionDateText(position.startDate, position.endDate, position.isCurrent),
) ),
); );
document.addParagraph(this.createRoleText(position.title)); document.addParagraph(this.createRoleText(position.title));
@ -182,14 +182,14 @@ class DocumentCreator {
document.addParagraph( document.addParagraph(
new docx.Paragraph( new docx.Paragraph(
"Dr. Dean Mohamedally Director of Postgraduate Studies Department of Computer Science, University College London Malet Place, Bloomsbury, London WC1E d.mohamedally@ucl.ac.uk" "Dr. Dean Mohamedally Director of Postgraduate Studies Department of Computer Science, University College London Malet Place, Bloomsbury, London WC1E d.mohamedally@ucl.ac.uk",
) ),
); );
document.addParagraph(new docx.Paragraph("More references upon request")); document.addParagraph(new docx.Paragraph("More references upon request"));
document.addParagraph( document.addParagraph(
new docx.Paragraph( new docx.Paragraph(
"This CV was generated in real-time based on my Linked-In profile from my personal website www.dolan.bio." "This CV was generated in real-time based on my Linked-In profile from my personal website www.dolan.bio.",
).center() ).center(),
); );
return document; return document;
} }
@ -311,4 +311,4 @@ const doc = documentCreator.create([experiences, education, skills, achievements
var exporter = new docx.LocalPacker(doc); var exporter = new docx.LocalPacker(doc);
exporter.pack("Dolan Miu CV"); exporter.pack("Dolan Miu CV");
console.log('Document created successfully at project root!'); console.log('Document created successfully at project root!');

View File

@ -163,7 +163,7 @@ describe("Paragraph", () => {
describe("#bullet()", () => { describe("#bullet()", () => {
it("should add list paragraph style to JSON", () => { it("should add list paragraph style to JSON", () => {
paragraph.bullet(); paragraph.bullet(0);
const tree = new Formatter().format(paragraph); const tree = new Formatter().format(paragraph);
expect(tree) expect(tree)
.to.have.property("w:p") .to.have.property("w:p")
@ -179,7 +179,7 @@ describe("Paragraph", () => {
}); });
it("it should add numbered properties", () => { it("it should add numbered properties", () => {
paragraph.bullet(); paragraph.bullet(1);
const tree = new Formatter().format(paragraph); const tree = new Formatter().format(paragraph);
expect(tree) expect(tree)
.to.have.property("w:p") .to.have.property("w:p")
@ -190,7 +190,7 @@ describe("Paragraph", () => {
.which.is.an("array") .which.is.an("array")
.which.has.length.at.least(2); .which.has.length.at.least(2);
expect(tree["w:p"][0]["w:pPr"][1]).to.deep.equal({ expect(tree["w:p"][0]["w:pPr"][1]).to.deep.equal({
"w:numPr": [{ "w:ilvl": [{ _attr: { "w:val": 0 } }] }, { "w:numId": [{ _attr: { "w:val": 1 } }] }], "w:numPr": [{ "w:ilvl": [{ _attr: { "w:val": 1 } }] }, { "w:numId": [{ _attr: { "w:val": 1 } }] }],
}); });
}); });
}); });