mirror of
https://github.com/webrecorder/browsertrix-crawler.git
synced 2026-04-18 07:00:22 +00:00
- sets up ts-jest for typescript tests - various type improvements, some shared functions add in utils.ts - fixes sitemap test to not check sitemapDone, as it does not mean all URLs have been queued, uses sitemap path to avoid redirect --------- Co-authored-by: Ilya Kreymer <ikreymer@gmail.com>
26 lines
699 B
TypeScript
26 lines
699 B
TypeScript
import { execSync } from "child_process";
|
|
import { ErrorWithStatus } from "./utils";
|
|
|
|
test("run crawl with invalid lang", () => {
|
|
let status = 0;
|
|
try {
|
|
execSync(
|
|
`docker run --rm webrecorder/browsertrix-crawler crawl --url https://webrecorder.net/feed.xml --lang e --limit 1`,
|
|
);
|
|
} catch (e) {
|
|
status = (e as ErrorWithStatus).status;
|
|
}
|
|
expect(status).toBe(17);
|
|
});
|
|
|
|
test("run crawl with valid lang", () => {
|
|
let status = 0;
|
|
try {
|
|
execSync(
|
|
`docker run --rm webrecorder/browsertrix-crawler crawl --url https://webrecorder.net/feed.xml --lang en --limit 1`,
|
|
);
|
|
} catch (e) {
|
|
status = (e as ErrorWithStatus).status;
|
|
}
|
|
expect(status).toBe(0);
|
|
});
|