Skip to content

Commit 9e30892

Browse files
authored
fix(all-services): refactor test case of auth service core and notification service (#2230)
fix(all-services): resfactor test case of auth service core and notif service resfactor test case of auth service core and notif service 2229
1 parent 1d93aa5 commit 9e30892

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

packages/core/src/components/logger-extension/winston/logger-console.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ export class WinstonConsoleLogger extends WinstonLoggerBase {
2222
const logFormat = format.combine(
2323
format.uncolorize(),
2424
format.timestamp(),
25-
format.printf(
26-
(log: LogEntry) =>
27-
`[${log.timestamp}] ${log.level} :: ${log.context ?? '-'} :: ${
28-
log.key
29-
} -> [${log.statusCode ?? '-'}] ${log.message}`,
30-
),
25+
format.printf((info: TransformableInfo) => {
26+
const log = info as LogEntry; // Type casting
27+
return `[${log.timestamp}] ${log.level} :: ${log.context ?? '-'} :: ${
28+
log.key
29+
} -> [${log.statusCode ?? '-'}] ${log.message}`;
30+
}),
3131
);
3232

3333
this.logger = createLogger({

services/authentication-service/src/__tests__/unit/bearer-verify.provider.unit.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ describe('Bearer Verify Signup Service', () => {
5858
}
5959

6060
function setUp() {
61+
jwtKeysRepo = sinon.createStubInstance(JwtKeysRepository); // Mock the repository
6162
bearerVerifyProvider = new SignupBearerVerifyProvider(jwtKeysRepo, logger);
6263
}
6364
});

services/notification-service/src/__tests__/unit/process-notification.service.unit.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,16 @@ describe('Process notification Service', () => {
132132
function setUp() {
133133
notificationRepository = createStubInstance(NotificationRepository);
134134
notificationUserRepository = createStubInstance(NotificationUserRepository);
135+
notifProvider = sinon.stub().resolves(); // Mock as a Sinon stub
136+
notifUserService = {
137+
getNotifUsers: sinon.stub().resolves([]), // Mock 'getNotifUsers' to return an empty array
138+
};
139+
// Mock `filterNotificationSettings` as a stub function
140+
filterNotificationSettings = {
141+
checkUserNotificationSettings: sinon.stub().resolves([]), // Mock with empty array
142+
getNotificationSubscribers: sinon.stub().resolves([]), // Mock with empty array
143+
getDraftSubscribers: sinon.stub().resolves([]), // Mock with empty array
144+
};
135145
processNotificationService = new ProcessNotificationService(
136146
notificationRepository,
137147
notifProvider,

0 commit comments

Comments
 (0)