Adds the mailing list setup.
This commit is contained in:
32
tests/mailer_framework.test.ts
Normal file
32
tests/mailer_framework.test.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { describe, expect, test } from "@jest/globals";
|
||||
import { Mailbox } from '../src/mailer_framework';
|
||||
|
||||
describe('Mailer Framework Test', () =>
|
||||
{
|
||||
let mailbox: Mailbox = new Mailbox({host: "", port: 0}, {host: "", port: 0}, "");
|
||||
test('Should only have one mailing list', () => {
|
||||
mailbox.addMailingList("test1", ["sample@gmail.com"]);
|
||||
expect(mailbox.getEmails("test1")).toMatchObject(["sample@gmail.com"]);
|
||||
});
|
||||
test("Mailing list corruption", () =>
|
||||
{
|
||||
// Make sure the first one does not change.
|
||||
mailbox.addMailingList("test2", ["sample@gmail.com", "sample2@gmail.com"]);
|
||||
expect(mailbox.getEmails("test1")).toMatchObject(["sample@gmail.com"]);
|
||||
expect(mailbox.getEmails("test2")).toMatchObject(["sample@gmail.com", "sample2@gmail.com"]);
|
||||
});
|
||||
test("Deregistration test", () =>
|
||||
{
|
||||
// Make sure the first one does not change.
|
||||
mailbox.unregisterEmailFromAll("sample@gmail.com");
|
||||
expect(mailbox.getEmails("test1")).toMatchObject([]);
|
||||
expect(mailbox.getEmails("test2")).toMatchObject(["sample2@gmail.com"]);
|
||||
});
|
||||
test("Existing registration test", () =>
|
||||
{
|
||||
// Make sure the first one does not change.
|
||||
mailbox.registerEmail("sample3@gmail.com", "test1");
|
||||
expect(mailbox.getEmails("test1")).toMatchObject(["sample3@gmail.com"]);
|
||||
expect(mailbox.getEmails("test2")).toMatchObject(["sample2@gmail.com"]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user