From 2769e297ca6703f761f9b57792585eb1fc5aac49 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 6 Aug 2018 11:45:24 +0200 Subject: Fix caption upload on Mac OS --- server/tests/utils/requests/requests.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'server/tests/utils/requests') diff --git a/server/tests/utils/requests/requests.ts b/server/tests/utils/requests/requests.ts index b88b3ce5b..fc7b38b8c 100644 --- a/server/tests/utils/requests/requests.ts +++ b/server/tests/utils/requests/requests.ts @@ -48,7 +48,7 @@ function makeUploadRequest (options: { path: string, token?: string, fields: { [ fieldName: string ]: any }, - attaches: { [ attachName: string ]: any }, + attaches: { [ attachName: string ]: any | any[] }, statusCodeExpected?: number }) { if (!options.statusCodeExpected) options.statusCodeExpected = 400 @@ -78,7 +78,11 @@ function makeUploadRequest (options: { Object.keys(options.attaches).forEach(attach => { const value = options.attaches[attach] - req.attach(attach, buildAbsoluteFixturePath(value)) + if (Array.isArray(value)) { + req.attach(attach, buildAbsoluteFixturePath(value[0]), value[1]) + } else { + req.attach(attach, buildAbsoluteFixturePath(value)) + } }) return req.expect(options.statusCodeExpected) -- cgit v1.2.3