mirror of
https://github.com/pezkuwichain/phishing.git
synced 2026-07-19 15:45:44 +00:00
Add test for malformed domains (#836)
This commit is contained in:
@@ -18,9 +18,9 @@
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.5",
|
||||
"@polkadot/util": "^8.1.2",
|
||||
"@polkadot/util-crypto": "^8.1.2",
|
||||
"@polkadot/x-fetch": "^8.1.2"
|
||||
"@polkadot/util": "^8.2.2",
|
||||
"@polkadot/util-crypto": "^8.2.2",
|
||||
"@polkadot/x-fetch": "^8.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
|
||||
@@ -9,6 +9,7 @@ import { checkAddress, checkIfDenied } from '.';
|
||||
|
||||
const addresses = JSON.parse(fs.readFileSync('address.json', 'utf-8')) as Record<string, string[]>;
|
||||
const allowed = JSON.parse(fs.readFileSync('known.json', 'utf-8')) as Record<string, string[]>;
|
||||
const all = JSON.parse(fs.readFileSync('all.json', 'utf8')) as { deny: string[] };
|
||||
|
||||
describe('checkIfDenied', (): void => {
|
||||
it('returns false when host is not listed', async (): Promise<void> => {
|
||||
@@ -107,4 +108,13 @@ describe('check additions', (): void => {
|
||||
|
||||
expect(dupes).toEqual([]);
|
||||
});
|
||||
|
||||
it('has no malformed domain-only entries', (): void => {
|
||||
const invalids = all.deny.filter((u) =>
|
||||
u.includes('/') ||
|
||||
u.includes('?')
|
||||
);
|
||||
|
||||
expect(invalids).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user