From f457b098b1e951a15ba92e0719d53083c2a614b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ilyas=20ak=C4=B1n?= Date: Sat, 18 Feb 2023 04:52:14 +0300 Subject: [PATCH] Fix CI failure caused by #1394 (#1406) --- __tests__/server/validate-data.js | 2 +- src/server/router/validate-data.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/__tests__/server/validate-data.js b/__tests__/server/validate-data.js index 0bc4e1936..f0abcb2a1 100644 --- a/__tests__/server/validate-data.js +++ b/__tests__/server/validate-data.js @@ -7,7 +7,7 @@ describe('validateData', () => { }) test('should throw an error if data is an array', () => { - assert.throws(() => validateData([]), /Data must be an object. Found array./) + assert.throws(() => validateData([]), /Data must be an object. Found array/) }) test("shouldn't throw an error", () => { diff --git a/src/server/router/validate-data.js b/src/server/router/validate-data.js index e6e4d52a2..4ea4dbfb0 100644 --- a/src/server/router/validate-data.js +++ b/src/server/router/validate-data.js @@ -17,8 +17,10 @@ module.exports = (obj) => { Object.keys(obj).forEach(validateKey) } else { throw new Error( - `Data must be an object. Found ${Array.isArray(obj) ? 'array' : typeof obj}.` + - 'See https://github.com/typicode/json-server for example.' + `Data must be an object. Found ${ + Array.isArray(obj) ? 'array' : typeof obj + } + 'See https://github.com/typicode/json-server for example.` ) } }