diff --git a/src/__tests__/ParseObject-test.js b/src/__tests__/ParseObject-test.js index 6d20f0960..7f529daa8 100644 --- a/src/__tests__/ParseObject-test.js +++ b/src/__tests__/ParseObject-test.js @@ -909,12 +909,9 @@ describe('ParseObject', () => { it('validates attributes on save()', async () => { const o = new ParseObject('Listing'); - try { - await o.save({ '$$$': 'o_O' }); - expect(true).toBe(false); - } catch (e) { - expect(e.code).toBe(ParseError.INVALID_KEY_NAME); - } + await expect(o.save({ '$$$': 'o_O' })).rejects.toEqual( + new ParseError(ParseError.INVALID_KEY_NAME) + ); }); it('ignores validation if ignoreValidation option is passed to set()', () => {