2023-02-03 00:02:47 -05:00
|
|
|
import child_process from "child_process";
|
|
|
|
import fs from "fs";
|
|
|
|
|
|
|
|
test("ensure --overwrite with existing collection results in a successful crawl", async () => {
|
2023-11-09 19:11:11 -05:00
|
|
|
child_process.execSync(
|
|
|
|
"docker run -v $PWD/test-crawls:/crawls webrecorder/browsertrix-crawler crawl --url http://www.example.com/ --generateWACZ --collection overwrite",
|
|
|
|
);
|
2023-02-03 00:02:47 -05:00
|
|
|
|
2023-11-09 19:11:11 -05:00
|
|
|
child_process.execSync(
|
|
|
|
"docker run -v $PWD/test-crawls:/crawls webrecorder/browsertrix-crawler crawl --url http://www.example.com/ --generateWACZ --collection overwrite --overwrite",
|
|
|
|
);
|
2023-02-03 00:02:47 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
test("check that the pages.jsonl file exists in the collection under the pages folder", () => {
|
2023-11-09 19:11:11 -05:00
|
|
|
expect(
|
|
|
|
fs.existsSync("test-crawls/collections/overwrite/pages/pages.jsonl"),
|
|
|
|
).toBe(true);
|
2023-02-03 00:02:47 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
test("check that the WACZ file exists in the collection", () => {
|
2023-11-09 19:11:11 -05:00
|
|
|
expect(
|
|
|
|
fs.existsSync("test-crawls/collections/overwrite/pages/pages.jsonl"),
|
|
|
|
).toBe(true);
|
2023-02-03 00:02:47 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
//-----------
|
|
|
|
|
|
|
|
test("ensure --overwrite results in a successful crawl even if collection didn't exist", async () => {
|
2023-11-09 19:11:11 -05:00
|
|
|
child_process.execSync(
|
|
|
|
"docker run -v $PWD/test-crawls:/crawls webrecorder/browsertrix-crawler crawl --url http://www.example.com/ --generateWACZ --collection overwrite-nothing --overwrite",
|
|
|
|
);
|
2023-02-03 00:02:47 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
test("check that the pages.jsonl file exists in the collection under the pages folder", () => {
|
2023-11-09 19:11:11 -05:00
|
|
|
expect(
|
|
|
|
fs.existsSync(
|
|
|
|
"test-crawls/collections/overwrite-nothing/pages/pages.jsonl",
|
|
|
|
),
|
|
|
|
).toBe(true);
|
2023-02-03 00:02:47 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
test("check that the WACZ file exists in the collection", () => {
|
2023-11-09 19:11:11 -05:00
|
|
|
expect(
|
|
|
|
fs.existsSync(
|
|
|
|
"test-crawls/collections/overwrite-nothing/pages/pages.jsonl",
|
|
|
|
),
|
|
|
|
).toBe(true);
|
2023-02-03 00:02:47 -05:00
|
|
|
});
|