browsertrix-crawler/tests/collection_name.test.js
Ilya Kreymer 183f8edf10
Wait for Pending Requests to Finish (#47)
* pending request wait:
- instead of waiting for 5s, check redis key 'pywb:{coll}:pending' to see if any pending requests are still pending
- keep checking key until pending requests are at 0
- requires latest pywb 2.6.0+
- should fix #44

* fix test to no longer look for waiting for 5s message

* lint settings and fixes: allow constant in loops, add lint command to script

* chrome: bump default image to chrome:90 image
2021-04-30 15:31:14 -04:00

32 lines
822 B
JavaScript

const util = require("util");
const exec = util.promisify(require("child_process").exec);
test("check that the collection name is properly validation", async () => {
jest.setTimeout(30000);
let passed = "";
try{
await exec("docker-compose run crawler crawl --url http://www.example.com/ --collection valid_collection-nameisvalid");
passed = true;
}
catch (error) {
passed = false;
}
expect(passed).toBe(true);
});
test("check that the collection name is not accepted if it doesn't meets our standards", async () => {
jest.setTimeout(30000);
let passed = "";
try{
await exec("docker-compose run crawler crawl --url http://www.example.com/ --collection invalid_c!!ollection-nameisvalid");
passed = true;
}
catch(e){
passed = false;
}
expect(passed).toBe(false);
});