From dd135afe2e850f2ef872681d7062633e8a290177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6?= Date: Tue, 3 Oct 2023 17:27:13 +0200 Subject: [PATCH] feat: add encodedSource tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ --- __tests__/files/node.spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/__tests__/files/node.spec.ts b/__tests__/files/node.spec.ts index c77a14b6..5092bdb9 100644 --- a/__tests__/files/node.spec.ts +++ b/__tests__/files/node.spec.ts @@ -387,3 +387,17 @@ describe('Undefined properties are allowed', () => { })).not.toThrow() }) }) + +describe('Encoded source is handled properly', () => { + test('File', () => { + const file = new File({ + source: 'https://cloud.domain.com/remote.php/dav/files/em ma!/Photos~⛰️ shot of a $[big} mountain/realy #1\'s.md', + owner: 'em ma!', + id: 123456, + mime: 'image/jpeg', + root: '/files/em ma!', + }) + + expect(file.encodedSource).toBe('https://cloud.domain.com/remote.php/dav/files/em%20ma!/Photos~%E2%9B%B0%EF%B8%8F%20shot%20of%20a%20%24%5Bbig%7D%20mountain/realy%20%231\'s.md') + }) +})