Skip to content

Commit 132d3cd

Browse files
coderabbitai[bot]CodeRabbit
andauthored
fix: apply CodeRabbit auto-fixes
Fixed 3 file(s) based on 2 unresolved review comments. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
1 parent 81a87a7 commit 132d3cd

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/test/__mocks__/filenamify.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
const filenamify = (str: string, _options?: { replacement?: string }) =>
2-
str.replace(/[<>:"/\\|?*\x00-\x1F]/g, '_');
1+
const filenamify = (str: string, options?: { replacement?: string; maxLength?: number }) => {
2+
const replacement = options?.replacement ?? '_';
3+
const maxLength = options?.maxLength ?? 252;
4+
5+
// Replace invalid characters with the specified replacement
6+
const sanitized = str.replace(/[<>:"/\\|?*\x00-\x1F]/g, replacement);
7+
8+
// Truncate to maxLength
9+
return sanitized.slice(0, maxLength);
10+
};
311

412
export default filenamify;

src/test/__mocks__/obsidian.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
import { jest } from '@jest/globals';
2+
import { parse } from 'yaml';
23

34
export const App = jest.fn();
45
export const Plugin = jest.fn();
56
export const TFile = jest.fn();
67
export const TFolder = jest.fn();
78
export class PluginManifest {}
89
export interface CachedMetadata {}
10+
11+
export function parseYaml(yaml: string): unknown {
12+
return parse(yaml);
13+
}
14+
915
// add other exports as needed

0 commit comments

Comments
 (0)