Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tw4l committed Sep 25, 2023
1 parent 666bf66 commit f60caf1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/seeds.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import child_process from "child_process";

test("ensure one invalid seed doesn't end crawl unless failOnFailedSeed is set", async () => {
child_process.execSync("docker run -v $PWD/test-crawls:/crawls webrecorder/browsertrix-crawler crawl --url https://www.iana.org/ --url example.com/invalid-seed --generateWACZ --collection invalidseed");

try {
child_process.execSync("docker run -v $PWD/test-crawls:/crawls webrecorder/browsertrix-crawler crawl --url https://www.iana.org/ --url example.com/invalid-seed --generateWACZ --collection failseed --failOnFailedSeed");
} catch (e) {
expect(e.status).toBe(17);
}
});

test("ensure crawl fails if no valid seeds are passed", async () => {
try {
child_process.execSync("docker run -v $PWD/test-crawls:/crawls webrecorder/browsertrix-crawler crawl --url iana.org/ --url example.com/invalid-seed --generateWACZ --collection allinvalidseeds");
} catch (e) {
expect(e.status).toBe(17);
}
});

0 comments on commit f60caf1

Please sign in to comment.