Skip to content

Commit 4e9c327

Browse files
authored
Add apexgunparts.space to newsletter spam-domain blacklist
1 parent fbced72 commit 4e9c327

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

src/utils/resend.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ describe('emailIsBad', () => {
4646
expect(result).toBe(true);
4747
});
4848

49+
it('should return true for apexgunparts.space domain', () => {
50+
const result = emailIsBad('4@apexgunparts.space');
51+
expect(result).toBe(true);
52+
});
53+
4954
it('should return false for legitimate email domains', () => {
5055
const legitimateEmails = [
5156
'user@gmail.com',
@@ -153,6 +158,11 @@ describe('fakeSubscribe', () => {
153158
const result = await fakeSubscribe({ email: 'test@abhoward.site' });
154159
expect(result).toEqual({ success: true });
155160
});
161+
162+
it('should return success for apexgunparts.space domain', async () => {
163+
const result = await fakeSubscribe({ email: '4@apexgunparts.space' });
164+
expect(result).toEqual({ success: true });
165+
});
156166
});
157167

158168
describe('isContactEvent', () => {
@@ -448,6 +458,23 @@ describe('subscribe', () => {
448458
expect(resend.contacts.create).not.toHaveBeenCalled();
449459
});
450460

461+
it('should return fake response for apexgunparts.space emails', async () => {
462+
const badSubscriber = {
463+
email: '4@apexgunparts.space',
464+
firstName: 'Spam',
465+
lastName: 'Bot',
466+
};
467+
468+
const result = await subscribe(badSubscriber);
469+
expect(result).toEqual({
470+
data: {
471+
id: '123',
472+
},
473+
error: null,
474+
});
475+
expect(resend.contacts.create).not.toHaveBeenCalled();
476+
});
477+
451478
it('should create contact for legitimate emails when contact does not exist', async () => {
452479
const legitimateSubscriber = {
453480
email: 'user@example.com',

src/utils/resend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ export const getSubscriberCount = async () => {
235235
}
236236
};
237237

238-
const BAD_DOMAINS = ['mailinator.com', 'abhoward.site'];
238+
const BAD_DOMAINS = ['mailinator.com', 'abhoward.site', 'apexgunparts.space'];
239239

240240
export const emailIsBad = (email: string) => {
241241
const domain = email.split('@')[1]?.toLowerCase();

0 commit comments

Comments
 (0)