browsertrix-crawler/tests/limit_reached.test.js
Emma Segal-Grossman 2a49406df7
Add Prettier to the repo, and format all the files! (#428)
This adds prettier to the repo, and sets up the pre-commit hook to
auto-format as well as lint.
Also updates ignores files to exclude crawls, test-crawls, scratch, dist as needed.
2023-11-09 16:11:11 -08:00

16 lines
663 B
JavaScript

import child_process from "child_process";
import fs from "fs";
test("ensure page limit reached", async () => {
child_process.execSync(
'docker run -v $PWD/test-crawls:/crawls webrecorder/browsertrix-crawler crawl --scopeType prefix --behaviors "" --url https://webrecorder.net/ --limit 12 --workers 2 --collection limit-test --statsFilename stats.json',
);
});
test("check limit written to stats file is as expected", () => {
const data = fs.readFileSync("test-crawls/stats.json", "utf8");
const dataJSON = JSON.parse(data);
expect(dataJSON.crawled).toEqual(12);
expect(dataJSON.total).toEqual(12);
expect(dataJSON.limit.hit).toBe(true);
});