mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
test(tasks): add unit test for URL basename with trailing slash
Verifies that URLs ending with '/' correctly extract the path segment as the attachment title without truncation. Example: https://example.com/projects/ → title: "projects" This test covers the bug fix in commit 2a8e7433b where the substring offset was corrected from -2 to -1.
This commit is contained in:
parent
a910183c10
commit
ce615015c9
1 changed files with 13 additions and 0 deletions
|
|
@ -1534,5 +1534,18 @@ describe('shortSyntax', () => {
|
|||
expect(r?.attachments.length).toBe(1);
|
||||
expect(r?.attachments[0].title).toBe('file');
|
||||
});
|
||||
|
||||
it('should extract basename correctly for URLs with trailing slash', () => {
|
||||
const t = {
|
||||
...TASK,
|
||||
title: 'Task https://example.com/projects/',
|
||||
};
|
||||
const r = shortSyntax(t, CONFIG);
|
||||
expect(r).toBeDefined();
|
||||
expect(r?.attachments.length).toBe(1);
|
||||
expect(r?.attachments[0].path).toBe('https://example.com/projects/');
|
||||
expect(r?.attachments[0].title).toBe('projects');
|
||||
expect(r?.taskChanges.title).toBe('Task');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue