Refactor code for improved readability and consistency
- Adjusted formatting in conversationContext.ts for better token estimation readability. - Enhanced readability in indonesianTextNormalizer.ts by formatting multiline replacements. - Reformatted badword lists and whitelists in indonesianTextNormalizer.ts for consistency. - Improved function signatures in messageStore.ts for clarity. - Reformatted messageCapture.ts to enhance readability of channel ID checks. - Cleaned up error logging in messageStore.ts and retentionManager.ts for better clarity. - Reformatted indonesianSlangLexicon.ts for consistent object formatting. - Enhanced URL fetching regex patterns in urlFetcher.ts for better readability. - Simplified query parameter destructuring in analyticsRoutes.ts for cleaner code. - Improved test readability in autoDeleteManager.test.ts and indonesianTextNormalizer.test.ts by formatting expectations. - Cleaned up whitespace in messageCaptureFilter.test.ts for consistency.
This commit is contained in:
@@ -46,11 +46,13 @@ function createMessage(overrides: Partial<MessageRecord> = {}): MessageRecord {
|
||||
};
|
||||
}
|
||||
|
||||
function createClient(options: {
|
||||
canManageMessages?: boolean;
|
||||
fetchError?: unknown;
|
||||
deleteError?: unknown;
|
||||
} = {}) {
|
||||
function createClient(
|
||||
options: {
|
||||
canManageMessages?: boolean;
|
||||
fetchError?: unknown;
|
||||
deleteError?: unknown;
|
||||
} = {},
|
||||
) {
|
||||
const deleteMock = vi.fn(async () => {
|
||||
if (options.deleteError) throw options.deleteError;
|
||||
});
|
||||
@@ -113,7 +115,11 @@ describe("attemptAutoDeleteFlaggedMessage", () => {
|
||||
createMessage(), // defaults to flagged
|
||||
);
|
||||
|
||||
expect(result).toEqual({ deleted: true, skipped: false, reason: "deleted" });
|
||||
expect(result).toEqual({
|
||||
deleted: true,
|
||||
skipped: false,
|
||||
reason: "deleted",
|
||||
});
|
||||
expect(fetchMessageMock).toHaveBeenCalledWith("m1");
|
||||
expect(deleteMock).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
@@ -127,7 +133,11 @@ describe("attemptAutoDeleteFlaggedMessage", () => {
|
||||
createMessage({ ai_status: "warn" }),
|
||||
);
|
||||
|
||||
expect(result).toEqual({ deleted: true, skipped: false, reason: "deleted" });
|
||||
expect(result).toEqual({
|
||||
deleted: true,
|
||||
skipped: false,
|
||||
reason: "deleted",
|
||||
});
|
||||
expect(fetchMessageMock).toHaveBeenCalledWith("m1");
|
||||
expect(deleteMock).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user