Feature/semantic similarity (#36)
* fix: mixed up migrations * feat: semantic similarity first take * feat: semantic similarity first round of fixes * feat: more work on making semantic similarity work properly * feat: getPostBySlug for the AI * feat: show similarity in post-link-insert-modal * chore: remove done doc --------- Co-authored-by: hugo <hugoms@me.com>
This commit is contained in:
@@ -370,4 +370,28 @@ describe('SettingsView Diff Preferences', () => {
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it('auto-saves semanticSimilarityEnabled immediately when toggled without requiring a Save click', async () => {
|
||||
(window as any).electronAPI.meta.getProjectMetadata = vi.fn().mockResolvedValue({
|
||||
maxPostsPerPage: 50,
|
||||
semanticSimilarityEnabled: false,
|
||||
categorySettings: {
|
||||
article: { renderInLists: true, showTitle: true },
|
||||
},
|
||||
});
|
||||
(window as any).electronAPI.meta.updateProjectMetadata = vi.fn().mockResolvedValue({});
|
||||
|
||||
render(<SettingsView />);
|
||||
|
||||
const checkbox = await screen.findByLabelText(/semantic similarity/i);
|
||||
expect((checkbox as HTMLInputElement).checked).toBe(false);
|
||||
|
||||
await act(async () => {
|
||||
fireEvent.click(checkbox);
|
||||
});
|
||||
|
||||
expect((window as any).electronAPI.meta.updateProjectMetadata).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ semanticSimilarityEnabled: true })
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user