You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test.js 1.2KB

123456789101112131415161718192021222324252627282930313233343536
  1. "use strict";
  2. var expect = require("chai").expect;
  3. var doc = require("../convert");
  4. describe("Convert files to pdf or/and image", function () {
  5. let options = {
  6. libreofficeBin: "C:\\Program Files\\LibreOffice\\program\\soffice.exe",
  7. sourceFile: "C:\\convert-pdf-img\\metro_powerpoint.pptx",
  8. outputDir: "C:\\convert-pdf-img\\files\\",
  9. img: true,
  10. imgExt: "jpg",
  11. reSize: 800,
  12. density: 120,
  13. };
  14. it("should return source file not exist", function () {
  15. options.sourceFile = "C:\\convert-pdf-img\\source\\metro_powerpoint.pptex";
  16. var result = doc.convert(options, function (err) {
  17. expect(err.message).to.equal("Source file does not exist.");
  18. });
  19. });
  20. it("should return invalid extesion", function () {
  21. options.sourceFile = "C:\\convert-pdf-img\\source\\sample.txt";
  22. var result = doc.convert(options, function (err) {
  23. expect(err.message).to.equal("Invalid extension.");
  24. });
  25. });
  26. it("should return error on image conversion process", function () {
  27. options.sourceFile = "C:\\convert-pdf-img\\source\\metro_powerpoint.pptx";
  28. options.outputDir = "abc";
  29. var result = doc.convert(options, function (err) {
  30. expect(err.message).to.equal("Error on image conversion process.");
  31. });
  32. });
  33. });