Skip to content

Commit

Permalink
[@dhealthdapps/backend] refactor(notifier): remove DappHelper depende…
Browse files Browse the repository at this point in the history
…ncy in AlertNotifier
  • Loading branch information
nsonanh committed Dec 30, 2022
1 parent d1264cb commit 835d017
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 9 deletions.
3 changes: 0 additions & 3 deletions runtime/backend/src/notifier/listeners/AlertNotifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { NotifierFactory } from "../concerns/NotifierFactory";
import { AlertsConfig } from "../../common/models/MonitoringConfig";
import { Notifier } from "../models/Notifier";
import { NotifierType } from "../models/NotifierType";
import { DappHelper } from "../../common/concerns/DappHelper";
import { LogService } from "../../common/services/LogService";

/**
Expand Down Expand Up @@ -71,12 +70,10 @@ export class AlertNotifier {
*
* @param {ConfigService} configService
* @param {NotifierFactory} notifierFactory
* @param {DappHelper} dappHelper
*/
constructor(
private readonly configService: ConfigService,
private readonly notifierFactory: NotifierFactory,
private readonly dappHelper: DappHelper,
) {
// get config
this.alertsConfig = this.configService.get<AlertsConfig>("alerts");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ describe("notifier/AlertNotifier", () => {
providers: [
AlertNotifier,
EventEmitter2, // requirement from AlertNotifier
DappHelper, // requirement from AlertNotifier
NotifierFactory, // requirement from AlertNotifier
EmailNotifier, // requirement from AlertNotifier
NetworkService, // requirement from DappHelper
Expand Down Expand Up @@ -71,7 +70,6 @@ describe("notifier/AlertNotifier", () => {
service = module.get<AlertNotifier>(AlertNotifier);
configService = module.get<ConfigService>(ConfigService);
notifierFactory = module.get<NotifierFactory>(NotifierFactory);
dappHelper = module.get<DappHelper>(DappHelper);
});

it("should be defined", () => {
Expand All @@ -91,9 +89,6 @@ describe("notifier/AlertNotifier", () => {
const notifierSendInternalCall = jest
.spyOn(notifier, "sendInternal")
.mockResolvedValue();
const dappHelperCreateDetailsTableHTMLCall = jest
.spyOn(dappHelper, "createDetailsTableHTML")
.mockReturnValue("test-html-content");
const alertEvent: AlertEvent = AlertEvent.create(
new Date(),
"warn",
Expand All @@ -108,7 +103,6 @@ describe("notifier/AlertNotifier", () => {

// assert
expect(configServiceGetCall).toHaveBeenCalledTimes(0);
expect(dappHelperCreateDetailsTableHTMLCall).toHaveBeenCalledTimes(0);
expect(notifierSendInternalCall).toHaveBeenCalledTimes(0);
});

Expand Down

0 comments on commit 835d017

Please sign in to comment.