Skip to content

Commit 196b7e0

Browse files
author
snip-cli
committed
refactor: Rename package to 'snip-manager', update package-lock, and enhance test for snippet editing
1 parent bd93af0 commit 196b7e0

File tree

4 files changed

+846
-8
lines changed

4 files changed

+846
-8
lines changed

__tests__/rm_edit.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ describe('edit and rm', () => {
1919
expect(after).toBeNull();
2020
});
2121

22-
test('edit updates content when file changes', () => {
22+
test('edit updates content when file changes', async () => {
2323
const s = storage.addSnippet({ name: 'editchange', content: 'original', language: 'txt', tags: [] });
24-
// Directly update the content via storage to simulate an edit
24+
const originalUpdatedAt = s.updatedAt;
25+
await new Promise(r => setTimeout(r, 10));
2526
storage.updateSnippetContent(s.id, 'modified');
2627
const updated = storage.getSnippetByIdOrName(s.id);
27-
expect(updated.updatedAt).not.toBe(s.updatedAt);
28-
// Cleanup
28+
expect(new Date(updated.updatedAt).getTime()).toBeGreaterThan(new Date(originalUpdatedAt).getTime());
2929
rmCmd(s.id);
3030
});
3131
});

0 commit comments

Comments
 (0)