style: run prettier formatter over src and tests

This commit is contained in:
2026-06-11 20:46:00 +05:30
parent 2389d4f297
commit 6b564a4569
211 changed files with 6134 additions and 4234 deletions
+2 -2
View File
@@ -39,7 +39,7 @@ describe('toAsciiTable', () => {
expect(out).toContain('| X | 100 |');
// Right-aligned: "YY" padStart(4) -> " YY", "25" padStart(3) -> " 25"
expect(out).toContain('| YY | 25 |');
});
});
});
describe('applyAsciiTransform', () => {
@@ -57,4 +57,4 @@ describe('applyAsciiTransform', () => {
const md = '# Hello\n\nNo tables here.';
expect(applyAsciiTransform(md)).toBe(md);
});
});
});
+4 -2
View File
@@ -6,7 +6,9 @@ describe('generateDocx', () => {
const blob = await generateDocx({ source: '# Hello\n\nWorld' });
expect(blob).toBeInstanceOf(Blob);
expect(blob.size).toBeGreaterThan(0);
expect(blob.type).toBe('application/vnd.openxmlformats-officedocument.wordprocessingml.document');
expect(blob.type).toBe(
'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
);
});
it('converts headings to docx heading styles', async () => {
@@ -21,4 +23,4 @@ describe('generateDocx', () => {
expect(blob).toBeInstanceOf(Blob);
expect(blob.size).toBeGreaterThan(0);
});
});
});
+1 -1
View File
@@ -38,4 +38,4 @@ describe('ipc wrapper', () => {
expect(result.error.code).toBe('CHANNEL_MISSING');
}
});
});
});
+1 -1
View File
@@ -27,4 +27,4 @@ describe('renderMarkdown', () => {
const html = renderMarkdown('<script>alert(1)</script>');
expect(html).not.toContain('<script>');
});
});
});
+1 -7
View File
@@ -1,11 +1,5 @@
import { describe, it, expect } from 'vitest';
import {
fadeIn,
slideInRight,
modalPop,
toastSpring,
sidebarToggle,
} from '@/lib/motion';
import { fadeIn, slideInRight, modalPop, toastSpring, sidebarToggle } from '@/lib/motion';
describe('motion presets', () => {
it('fadeIn is a valid transition object', () => {
+11 -12
View File
@@ -3,18 +3,19 @@ import { render, act } from '@testing-library/react';
import { useCommandStore } from '@/stores/command-store';
import { useFileStore } from '@/stores/file-store';
import { useAppStore } from '@/stores/app-store';
import { useRegisterMenuCommands, useBridgeNativeMenu } from '@/lib/commands/register-menu-commands';
import {
useRegisterMenuCommands,
useBridgeNativeMenu,
} from '@/lib/commands/register-menu-commands';
type Cleanup = () => void;
const menuListeners = new Map<string, (...args: unknown[]) => void>();
const menuOn = vi.fn(
(channel: string, callback: (...args: unknown[]) => void): Cleanup => {
menuListeners.set(channel, callback);
return () => {
if (menuListeners.get(channel) === callback) menuListeners.delete(channel);
};
}
);
const menuOn = vi.fn((channel: string, callback: (...args: unknown[]) => void): Cleanup => {
menuListeners.set(channel, callback);
return () => {
if (menuListeners.get(channel) === callback) menuListeners.delete(channel);
};
});
vi.mock('@/lib/ipc', () => ({
ipc: {
@@ -146,9 +147,7 @@ describe('useRegisterMenuCommands + useBridgeNativeMenu', () => {
it('file.clearRecent does NOT clear openTabs', () => {
useFileStore.setState({
openTabs: [
{ id: '/a.md', path: '/a.md', title: 'a.md', dirty: false },
],
openTabs: [{ id: '/a.md', path: '/a.md', title: 'a.md', dirty: false }],
activeTabId: '/a.md',
});
render(<Harness />);
+12 -4
View File
@@ -21,7 +21,9 @@ describe('settingsSchema', () => {
describe('exportPdfSchema', () => {
it('accepts a4 + normal margins + embedFonts true', () => {
expect(exportPdfSchema.safeParse({ format: 'a4', margins: 'normal', embedFonts: true }).success).toBe(true);
expect(
exportPdfSchema.safeParse({ format: 'a4', margins: 'normal', embedFonts: true }).success
).toBe(true);
});
it('rejects unknown format', () => {
expect(exportPdfSchema.safeParse({ format: 'b4' }).success).toBe(false);
@@ -39,15 +41,21 @@ describe('exportDocxSchema', () => {
describe('exportHtmlSchema', () => {
it('accepts github highlight style', () => {
expect(exportHtmlSchema.safeParse({ standalone: true, highlightStyle: 'github' }).success).toBe(true);
expect(exportHtmlSchema.safeParse({ standalone: true, highlightStyle: 'github' }).success).toBe(
true
);
});
});
describe('exportBatchSchema', () => {
it('accepts a non-empty file list', () => {
expect(exportBatchSchema.safeParse({ format: 'pdf', concurrency: 4, filePaths: ['/a.md'] }).success).toBe(true);
expect(
exportBatchSchema.safeParse({ format: 'pdf', concurrency: 4, filePaths: ['/a.md'] }).success
).toBe(true);
});
it('rejects empty file list', () => {
expect(exportBatchSchema.safeParse({ format: 'pdf', concurrency: 4, filePaths: [] }).success).toBe(false);
expect(
exportBatchSchema.safeParse({ format: 'pdf', concurrency: 4, filePaths: [] }).success
).toBe(false);
});
});