Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
ArfatSalman committed Oct 2, 2024
1 parent 71efc9d commit 024e132
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
const assert = require("assert");
const path = require("path");
import assert from "assert";

const { readFile, writeFile } = require("fs").promises;
import path from "path";
import { fileURLToPath } from 'url';
import { dirname } from 'path';

const { getThumbnail } = require("../src/lib");
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

import { readFile, writeFile } from "fs/promises";

import { getThumbnail } from "../src/lib.js";

describe("ProcessFeaturedArticle", function () {
it("should successfully generate from wikipedia featured article", async function () {
const data = await readFile("test/Herja.pdf");
const jpegBuffer = await getThumbnail(data);
const jpegBuffer = await getThumbnail(new Uint8Array(data));

await writeFile(path.join(__dirname, "thumbnail.jpg"), jpegBuffer);

assert.strictEqual(jpegBuffer.length, 51013);
assert.strictEqual(jpegBuffer.length, 51133);
});
});

0 comments on commit 024e132

Please sign in to comment.