authelia/server/test/notifiers/NotifierFactory.test.ts

42 lines
1.2 KiB
TypeScript
Raw Normal View History

2017-05-20 07:49:05 +00:00
import * as sinon from "sinon";
import * as BluebirdPromise from "bluebird";
import * as assert from "assert";
import { NotifierFactory } from "../../src/lib/notifiers/NotifierFactory";
import { GMailNotifier } from "../../src/lib/notifiers/GMailNotifier";
import { SmtpNotifier } from "../../src/lib/notifiers/SmtpNotifier";
import { MailSenderBuilderStub } from "../mocks/notifiers/MailSenderBuilderStub";
2017-05-20 07:49:05 +00:00
describe("test notifier factory", function () {
let mailSenderBuilderStub: MailSenderBuilderStub;
it("should build a Gmail Notifier", function () {
2017-05-20 07:49:05 +00:00
const options = {
gmail: {
username: "abc",
password: "password",
sender: "admin@example.com"
2017-05-20 07:49:05 +00:00
}
};
mailSenderBuilderStub = new MailSenderBuilderStub();
assert(NotifierFactory.build(options, mailSenderBuilderStub) instanceof GMailNotifier);
2017-05-20 07:49:05 +00:00
});
it("should build a SMTP Notifier", function () {
2017-05-20 07:49:05 +00:00
const options = {
2017-09-24 18:55:11 +00:00
smtp: {
username: "user",
password: "pass",
secure: true,
host: "localhost",
port: 25,
sender: "admin@example.com"
2017-05-20 07:49:05 +00:00
}
};
mailSenderBuilderStub = new MailSenderBuilderStub();
assert(NotifierFactory.build(options, mailSenderBuilderStub) instanceof SmtpNotifier);
2017-05-20 07:49:05 +00:00
});
});