-
-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathrecorder.test.js
More file actions
31 lines (26 loc) · 1.27 KB
/
recorder.test.js
File metadata and controls
31 lines (26 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import util from "util";
import { exec as execCallback } from "child_process";
const exec = util.promisify(execCallback);
test("ensure URLs with array-valued headers succeed without multiValueHeader errors", async () => {
// Facebook and other sites return array-valued headers that aren't in the
// multiValueHeader allowed list (set-cookie, warc-concurrent-to, warc-protocol)
// This test verifies that such headers are properly joined with ", " instead of
// throwing "not a valid multi value header" error
let passed = true;
let output = "";
try {
const result = await exec(
"docker run -v $PWD/test-crawls:/crawls webrecorder/browsertrix-crawler crawl --url https://www.facebook.com/permalink.php?story_fbid=pfbid0BqNZHQaQfqTAKzVaaeeYNuyPXFJhkPmzwWT7mZPZJLFnHNEvsdbnLJRPkHJDMcqFl&id=100082135548177 --scopeType page --limit 1 --collection multivalueheadertest",
);
output = result.stdout + result.stderr;
} catch (error) {
console.log(error);
output = error.stdout + error.stderr;
passed = false;
}
// Should not contain the multiValueHeader error
expect(output).not.toContain("not a valid multi value header");
// Should successfully crawl at least one page
expect(output).toMatch(/crawled:\s+1/);
expect(passed).toBe(true);
});