mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
d8ff186303
Client and server now have their own tsconfig so that the transpilation is only done on the part that is being modified. It also allows faster transpilation since tests are now excluded from tsconfig. They are compiled by ts-node during unit tests execution.
45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
|
|
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 NodemailerMock = require("../mocks/nodemailer");
|
|
|
|
|
|
describe("test notifier factory", function() {
|
|
let nodemailerMock: NodemailerMock.NodemailerMock;
|
|
it("should build a Gmail Notifier", function() {
|
|
const options = {
|
|
gmail: {
|
|
username: "abc",
|
|
password: "password"
|
|
}
|
|
};
|
|
nodemailerMock = NodemailerMock.NodemailerMock();
|
|
const transporterMock = NodemailerMock.NodemailerTransporterMock();
|
|
nodemailerMock.createTransport.returns(transporterMock);
|
|
assert(NotifierFactory.build(options, nodemailerMock) instanceof GMailNotifier);
|
|
});
|
|
|
|
it("should build a SMTP Notifier", function() {
|
|
const options = {
|
|
smtp: {
|
|
username: "user",
|
|
password: "pass",
|
|
secure: true,
|
|
host: "localhost",
|
|
port: 25
|
|
}
|
|
};
|
|
|
|
nodemailerMock = NodemailerMock.NodemailerMock();
|
|
const transporterMock = NodemailerMock.NodemailerTransporterMock();
|
|
nodemailerMock.createTransport.returns(transporterMock);
|
|
assert(NotifierFactory.build(options, nodemailerMock) instanceof SmtpNotifier);
|
|
});
|
|
});
|