2022-10-24 15:30:10 +02:00
|
|
|
import child_process from "child_process";
|
|
|
|
import fs from "fs";
|
2021-07-23 18:31:43 -07:00
|
|
|
|
2024-11-08 08:04:41 -08:00
|
|
|
test("ensure custom driver creates PDF", async () => {
|
2021-07-23 18:31:43 -07:00
|
|
|
try {
|
2023-11-09 19:11:11 -05:00
|
|
|
child_process.execSync(
|
2024-11-08 08:04:41 -08:00
|
|
|
"docker run -v $PWD/tests/fixtures:/tests/fixtures -v $PWD/test-crawls:/crawls webrecorder/browsertrix-crawler crawl --url https://old.webrecorder.net/ --collection custom-driver-1 --driver /tests/fixtures/driver-1.mjs --limit 1",
|
2023-11-09 19:11:11 -05:00
|
|
|
);
|
|
|
|
} catch (error) {
|
2021-07-23 18:31:43 -07:00
|
|
|
console.log(error);
|
|
|
|
}
|
|
|
|
|
2024-11-08 08:04:41 -08:00
|
|
|
const pdfs = fs.readdirSync("test-crawls/collections/custom-driver-1").filter(x => x.endsWith(".pdf"));
|
|
|
|
expect(pdfs.length).toBe(1);
|
2021-07-23 18:31:43 -07:00
|
|
|
});
|