Fix CI failure caused by #1394 (#1406)

This commit is contained in:
ilyas akın
2023-02-18 04:52:14 +03:00
committed by GitHub
parent e371afd9bb
commit f457b098b1
2 changed files with 5 additions and 3 deletions

View File

@ -7,7 +7,7 @@ describe('validateData', () => {
}) })
test('should throw an error if data is an array', () => { 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", () => { test("shouldn't throw an error", () => {

View File

@ -17,8 +17,10 @@ module.exports = (obj) => {
Object.keys(obj).forEach(validateKey) Object.keys(obj).forEach(validateKey)
} else { } else {
throw new Error( throw new Error(
`Data must be an object. Found ${Array.isArray(obj) ? 'array' : typeof obj}.` + `Data must be an object. Found ${
'See https://github.com/typicode/json-server for example.' Array.isArray(obj) ? 'array' : typeof obj
}
'See https://github.com/typicode/json-server for example.`
) )
} }
} }