mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-02 18:10:18 +05:30
style: run prettier formatter over src and tests
This commit is contained in:
@@ -53,7 +53,10 @@ describe('useAppStore (modal)', () => {
|
||||
|
||||
it('openModal with kind requiring props passes them through', () => {
|
||||
useAppStore.getState().openModal('export-pdf', { sourcePath: '/a.md' });
|
||||
expect(useAppStore.getState().modal).toEqual({ kind: 'export-pdf', props: { sourcePath: '/a.md' } });
|
||||
expect(useAppStore.getState().modal).toEqual({
|
||||
kind: 'export-pdf',
|
||||
props: { sourcePath: '/a.md' },
|
||||
});
|
||||
});
|
||||
|
||||
it('closeModal clears the modal state', () => {
|
||||
|
||||
@@ -44,4 +44,4 @@ describe('useEditorStore', () => {
|
||||
expect(newBuf?.path).toBe('/bar.md');
|
||||
expect(useEditorStore.getState().activeId).toBe('file-2');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -54,7 +54,9 @@ describe('file-store toasts', () => {
|
||||
openTabs: [{ id: '/test.md', path: '/test.md', title: 'test.md', dirty: false }],
|
||||
} as any);
|
||||
useEditorStore.setState({
|
||||
buffers: new Map([['/test.md', { id: '/test.md', path: '/test.md', content: '# hi', dirty: true }]]),
|
||||
buffers: new Map([
|
||||
['/test.md', { id: '/test.md', path: '/test.md', content: '# hi', dirty: true }],
|
||||
]),
|
||||
activeId: '/test.md',
|
||||
} as any);
|
||||
|
||||
@@ -64,13 +66,18 @@ describe('file-store toasts', () => {
|
||||
});
|
||||
|
||||
it('calls toast.error when save fails', async () => {
|
||||
fakeWrite.mockResolvedValue({ ok: false, error: { code: 'EACCES', message: 'Permission denied' } });
|
||||
fakeWrite.mockResolvedValue({
|
||||
ok: false,
|
||||
error: { code: 'EACCES', message: 'Permission denied' },
|
||||
});
|
||||
useFileStore.setState({
|
||||
activeTabId: '/test.md',
|
||||
openTabs: [{ id: '/test.md', path: '/test.md', title: 'test.md', dirty: false }],
|
||||
} as any);
|
||||
useEditorStore.setState({
|
||||
buffers: new Map([['/test.md', { id: '/test.md', path: '/test.md', content: '# hi', dirty: true }]]),
|
||||
buffers: new Map([
|
||||
['/test.md', { id: '/test.md', path: '/test.md', content: '# hi', dirty: true }],
|
||||
]),
|
||||
activeId: '/test.md',
|
||||
} as any);
|
||||
|
||||
@@ -91,10 +98,13 @@ describe('file-store toasts', () => {
|
||||
|
||||
describe('openFolder', () => {
|
||||
it('calls toast.error when IPC list fails', async () => {
|
||||
fakeList.mockResolvedValue({ ok: false, error: { code: 'EACCES', message: 'Permission denied' } });
|
||||
fakeList.mockResolvedValue({
|
||||
ok: false,
|
||||
error: { code: 'EACCES', message: 'Permission denied' },
|
||||
});
|
||||
|
||||
await useFileStore.getState().openFolder('/forbidden');
|
||||
expect(toast.error).toHaveBeenCalledWith('Failed to open folder: Permission denied');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -49,10 +49,7 @@ describe('useFileStore', () => {
|
||||
it('openFolder calls ipc.file.list and sets tree with root node and mapped children', async () => {
|
||||
fakeList.mockResolvedValue({
|
||||
ok: true,
|
||||
data: [
|
||||
fakeFileEntry('README.md', false),
|
||||
fakeFileEntry('src', true),
|
||||
],
|
||||
data: [fakeFileEntry('README.md', false), fakeFileEntry('src', true)],
|
||||
});
|
||||
|
||||
await useFileStore.getState().openFolder('/root');
|
||||
@@ -139,7 +136,9 @@ describe('useFileStore', () => {
|
||||
path: '/root',
|
||||
isDirectory: true,
|
||||
loaded: true,
|
||||
children: [{ name: 'src', path: '/root/src', isDirectory: true, children: null, loaded: true }],
|
||||
children: [
|
||||
{ name: 'src', path: '/root/src', isDirectory: true, children: null, loaded: true },
|
||||
],
|
||||
};
|
||||
useFileStore.setState({ tree });
|
||||
|
||||
|
||||
@@ -41,4 +41,4 @@ describe('useSettingsStore', () => {
|
||||
expect(parsed.state.setSetting).toBeUndefined();
|
||||
expect(parsed.state.resetToDefaults).toBeUndefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user