Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(all-services): refactor test case of auth service core and notification service #2230

Merged
merged 1 commit into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading