From b6a44594cf65a49f1b5a29e1d1fe1d9bc86aebc5 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 12 Jan 2025 12:49:52 +1100 Subject: [PATCH] refactor: expand file tests --- spec/ParseFile.spec.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/spec/ParseFile.spec.js b/spec/ParseFile.spec.js index 1624007e0d..6be506be8d 100644 --- a/spec/ParseFile.spec.js +++ b/spec/ParseFile.spec.js @@ -378,6 +378,26 @@ describe('Parse.File testing', () => { expect(response.headers['content-type']).toMatch(/^text\/html/); }); + it('works without Content-Type and extension', async () => { + await reconfigureServer({ + fileUpload: { + enableForPublic: true, + }, + }); + const headers = { + 'X-Parse-Application-Id': 'test', + 'X-Parse-REST-API-Key': 'rest', + }; + const result = await request({ + method: 'POST', + headers: headers, + url: 'http://localhost:8378/1/files/file', + body: '\n', + }); + expect(result.data.url.includes('file.txt')).toBeTrue(); + expect(result.data.name.includes('file.txt')).toBeTrue(); + }); + it('filename is url encoded', done => { const headers = { 'Content-Type': 'text/html',