authelia/test/unitary/notifiers/NotifierFactory.test.ts

37 lines
1.0 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 NodemailerMock = require("../mocks/nodemailer");
import { NotifierFactory } from "../../../src/lib/notifiers/NotifierFactory";
import { GMailNotifier } from "../../../src/lib/notifiers/GMailNotifier";
import { FileSystemNotifier } from "../../../src/lib/notifiers/FileSystemNotifier";
2017-05-20 20:55:37 +00:00
import nodemailerMock = require("../mocks/nodemailer");
2017-05-20 07:49:05 +00:00
2017-05-20 20:55:37 +00:00
describe("test notifier factory", function() {
2017-05-20 07:49:05 +00:00
it("should build a Gmail Notifier", function() {
const options = {
gmail: {
username: "abc",
password: "password"
}
};
2017-05-20 20:55:37 +00:00
nodemailerMock.createTransport.returns(sinon.spy());
assert(NotifierFactory.build(options, nodemailerMock) instanceof GMailNotifier);
2017-05-20 07:49:05 +00:00
});
it("should build a FS Notifier", function() {
const options = {
filesystem: {
filename: "abc"
}
};
2017-05-20 20:55:37 +00:00
assert(NotifierFactory.build(options, nodemailerMock) instanceof FileSystemNotifier);
2017-05-20 07:49:05 +00:00
});
});