Skip to content

Commit f82d250

Browse files
committed
Correct import
1 parent db0a9af commit f82d250

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/__tests__/hmacValidator.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import HmacValidator from "../utils/hmacValidator";
22
import {NotificationItem, NotificationRequestItem } from "../typings/notification/models";
33
import { ApiConstants } from "../constants/apiConstants";
44
import NotificationRequestService from "../notification/notificationRequest";
5-
const fs = require('fs');
5+
import { readFileSync } from "fs";
66

77
const key = "DFB1EB5485895CFA84146406857104ABB4CBCABDC8AAF103A624C8F6A3EAAB00";
88
const expectedSign = "ZNBPtI+oDyyRrLyD1XirkKnQgIAlFc07Vj27TeHsDRE=";
@@ -130,19 +130,19 @@ describe("HMAC Validator", function (): void {
130130
});
131131

132132
it("should calculate Banking webhook correctly", function (): void {
133-
const data = fs.readFileSync('./src/__mocks__/notification/accountHolderCreated.json', 'utf8');
133+
const data = readFileSync("./src/__mocks__/notification/accountHolderCreated.json", "utf8");
134134
const encrypted = hmacValidator.calculateHmac(data, "11223344D785FBAE710E7F943F307971BB61B21281C98C9129B3D4018A57B2EB");
135135

136136
expect(encrypted).toEqual("UVBzHbDayhfT1XgaRGAkuKvxwoxrLoVCBdfi3WZU8lI=");
137137
});
138138

139139
it("should validate Banking webhook correctly", function (): void {
140-
const hmacKey = "11223344D785FBAE710E7F943F307971BB61B21281C98C9129B3D4018A57B2EB"
141-
const hmacSignature = "UVBzHbDayhfT1XgaRGAkuKvxwoxrLoVCBdfi3WZU8lI="
142-
const data = fs.readFileSync('./src/__mocks__/notification/accountHolderCreated.json', 'utf8');
140+
const hmacKey = "11223344D785FBAE710E7F943F307971BB61B21281C98C9129B3D4018A57B2EB";
141+
const hmacSignature = "UVBzHbDayhfT1XgaRGAkuKvxwoxrLoVCBdfi3WZU8lI=";
142+
const data = readFileSync("./src/__mocks__/notification/accountHolderCreated.json", "utf8");
143143
const isValid = hmacValidator.validateHMACSignature(hmacKey, hmacSignature, data);
144144

145-
expect(isValid).toBeTruthy
145+
expect(isValid).toBeTruthy;
146146
});
147147

148148
});

0 commit comments

Comments
 (0)