2017-05-20 14:49:05 +07: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-21 00:16:57 +07:00
|
|
|
import { NotifierDependencies } from "../../../src/types/Dependencies";
|
2017-05-20 14:49:05 +07:00
|
|
|
|
|
|
|
|
|
|
|
describe("test notifier", function() {
|
|
|
|
const deps: NotifierDependencies = {
|
|
|
|
nodemailer: NodemailerMock
|
|
|
|
};
|
|
|
|
|
|
|
|
it("should build a Gmail Notifier", function() {
|
|
|
|
const options = {
|
|
|
|
gmail: {
|
|
|
|
username: "abc",
|
|
|
|
password: "password"
|
|
|
|
}
|
|
|
|
};
|
|
|
|
assert(NotifierFactory.build(options, deps) instanceof GMailNotifier);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should build a FS Notifier", function() {
|
|
|
|
const options = {
|
|
|
|
filesystem: {
|
|
|
|
filename: "abc"
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
assert(NotifierFactory.build(options, deps) instanceof FileSystemNotifier);
|
|
|
|
});
|
|
|
|
});
|