From ce615015c92615af3197778f55325ed232a989a9 Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Tue, 20 Jan 2026 18:58:48 +0100 Subject: [PATCH] test(tasks): add unit test for URL basename with trailing slash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/app/features/tasks/short-syntax.spec.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/app/features/tasks/short-syntax.spec.ts b/src/app/features/tasks/short-syntax.spec.ts index 3c275d0ae..fd7f1e718 100644 --- a/src/app/features/tasks/short-syntax.spec.ts +++ b/src/app/features/tasks/short-syntax.spec.ts @@ -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'); + }); }); });