privacy-scan test: a neutral example context for the allowlist
This commit is contained in:
parent
85622f4c92
commit
d31b33db7f
1 changed files with 3 additions and 3 deletions
|
|
@ -171,12 +171,12 @@ test('terms file: comments skipped, short terms get the account rule, generic ac
|
||||||
|
|
||||||
test('allowlist: a reviewed context is skipped; the file may not hold a term', () => {
|
test('allowlist: a reviewed context is skipped; the file may not hold a term', () => {
|
||||||
const root = dir();
|
const root = dir();
|
||||||
writeFileSync(join(root, 'allow.txt'), '# HTTP header names\nsrc/**/*.rs: <term>-Age\n');
|
writeFileSync(join(root, 'allow.txt'), '# a generated identifier\nsrc/**/*.rs: <term>-Id\n');
|
||||||
const matcher = createMatcher(TERMS);
|
const matcher = createMatcher(TERMS);
|
||||||
const allow = loadAllowlist(join(root, 'allow.txt'), matcher);
|
const allow = loadAllowlist(join(root, 'allow.txt'), matcher);
|
||||||
const scan = createScan({ terms: TERMS, allow });
|
const scan = createScan({ terms: TERMS, allow });
|
||||||
scan.content('src/net/cookie.rs', Buffer.from('header("Qix-Age=3600")\n// Qix wrote this\n'));
|
scan.content('src/net/cookie.rs', Buffer.from('header("Qix-Id=3600")\n// Qix wrote this\n'));
|
||||||
scan.content('docs/cookie.md', Buffer.from('Qix-Age\n'));
|
scan.content('docs/cookie.md', Buffer.from('Qix-Id\n'));
|
||||||
const report = scan.report();
|
const report = scan.report();
|
||||||
assert.deepEqual(report.files.map(entry => [entry.file, entry.hits.map(hit => hit.where)]), [['src/net/cookie.rs', ['2:4']], ['docs/cookie.md', ['1:1']]]);
|
assert.deepEqual(report.files.map(entry => [entry.file, entry.hits.map(hit => hit.where)]), [['src/net/cookie.rs', ['2:4']], ['docs/cookie.md', ['1:1']]]);
|
||||||
writeFileSync(join(root, 'bad.txt'), 'src/**: by zorblat\n');
|
writeFileSync(join(root, 'bad.txt'), 'src/**: by zorblat\n');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue