Skip to content

Commit

Permalink
fix(all-services): resfactor test case of auth service core and notif…
Browse files Browse the repository at this point in the history
… service

resfactor test case of auth service core and notif service

2229
  • Loading branch information
Tyagi-Sunny committed Dec 23, 2024
1 parent 1d93aa5 commit 478828c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ export class WinstonConsoleLogger extends WinstonLoggerBase {
const logFormat = format.combine(
format.uncolorize(),
format.timestamp(),
format.printf(
(log: LogEntry) =>
`[${log.timestamp}] ${log.level} :: ${log.context ?? '-'} :: ${
log.key
} -> [${log.statusCode ?? '-'}] ${log.message}`,
),
format.printf((info: TransformableInfo) => {
const log = info as LogEntry; // Type casting
return `[${log.timestamp}] ${log.level} :: ${log.context ?? '-'} :: ${
log.key
} -> [${log.statusCode ?? '-'}] ${log.message}`;
}),
);

this.logger = createLogger({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ describe('Bearer Verify Signup Service', () => {
}

function setUp() {
jwtKeysRepo = sinon.createStubInstance(JwtKeysRepository); // Mock the repository
bearerVerifyProvider = new SignupBearerVerifyProvider(jwtKeysRepo, logger);
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,16 @@ describe('Process notification Service', () => {
function setUp() {
notificationRepository = createStubInstance(NotificationRepository);
notificationUserRepository = createStubInstance(NotificationUserRepository);
notifProvider = sinon.stub().resolves(); // Mock as a Sinon stub
notifUserService = {
getNotifUsers: sinon.stub().resolves([]), // Mock 'getNotifUsers' to return an empty array
};
// Mock `filterNotificationSettings` as a stub function
filterNotificationSettings = {
checkUserNotificationSettings: sinon.stub().resolves([]), // Mock with empty array
getNotificationSubscribers: sinon.stub().resolves([]), // Mock with empty array
getDraftSubscribers: sinon.stub().resolves([]), // Mock with empty array
};
processNotificationService = new ProcessNotificationService(
notificationRepository,
notifProvider,
Expand Down

0 comments on commit 478828c

Please sign in to comment.