mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-03 02:11:07 +05:30
style: run prettier formatter over src and tests
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -38,4 +38,4 @@ describe('ipc wrapper', () => {
|
||||
expect(result.error.code).toBe('CHANNEL_MISSING');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -27,4 +27,4 @@ describe('renderMarkdown', () => {
|
||||
const html = renderMarkdown('<script>alert(1)</script>');
|
||||
expect(html).not.toContain('<script>');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -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 />);
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user