From 8b9187428a761147c75b953cebf821c9169825c0 Mon Sep 17 00:00:00 2001 From: Jaco Date: Sun, 2 Jan 2022 08:54:28 +0100 Subject: [PATCH] Check for duplicate additions (#884) --- packages/phishing/src/index.spec.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/packages/phishing/src/index.spec.ts b/packages/phishing/src/index.spec.ts index b08a67d97..a72e97cb1 100644 --- a/packages/phishing/src/index.spec.ts +++ b/packages/phishing/src/index.spec.ts @@ -117,4 +117,28 @@ describe('check additions', (): void => { expect(invalids).toEqual([]); }); + + it('has no urls starting with www. (domain-only inclusions)', (): void => { + const invalids = all.deny.filter((u) => + u.startsWith('www.') + ); + + expect(invalids).toEqual([]); + }); + + it('has no duplicate entries', (): void => { + const checks: string[] = []; + + const dupes = all.deny.reduce((dupes, url) => { + if (!checks.includes(url)) { + checks.push(url); + } else { + dupes.push(url); + } + + return dupes; + }, []); + + expect(dupes).toEqual([]); + }); });