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

40 lines
1.2 KiB
TypeScript
Raw Normal View History

2017-05-20 14:49:05 +07: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 14:49:05 +07:00
describe("test notifier factory", function () {
let mailSenderBuilderStub: MailSenderBuilderStub;
it("should build a Gmail Notifier", function () {
2017-05-20 14:49:05 +07:00
const options = {
gmail: {
username: "abc",
password: "password"
}
};
mailSenderBuilderStub = new MailSenderBuilderStub();
assert(NotifierFactory.build(options, mailSenderBuilderStub) instanceof GMailNotifier);
2017-05-20 14:49:05 +07:00
});
it("should build a SMTP Notifier", function () {
2017-05-20 14:49:05 +07:00
const options = {
2017-09-25 01:55:11 +07:00
smtp: {
username: "user",
password: "pass",
secure: true,
host: "localhost",
port: 25
2017-05-20 14:49:05 +07:00
}
};
mailSenderBuilderStub = new MailSenderBuilderStub();
assert(NotifierFactory.build(options, mailSenderBuilderStub) instanceof SmtpNotifier);
2017-05-20 14:49:05 +07:00
});
});