refactor: replace hardcoded error codes with references (#7546)

This commit is contained in:
dblythy
2021-10-19 05:19:47 +11:00
committed by GitHub
parent b5fc0d59db
commit 12eb6c823b
13 changed files with 85 additions and 52 deletions

View File

@@ -161,7 +161,7 @@ describe('Cloud Code Logger', () => {
expect(log[0]).toEqual('error');
const error = log[2].error;
expect(error instanceof Parse.Error).toBeTruthy();
expect(error.code).toBe(141);
expect(error.code).toBe(Parse.Error.SCRIPT_FAILED);
expect(error.message).toBe('uh oh!');
done();
});
@@ -199,7 +199,9 @@ describe('Cloud Code Logger', () => {
expect(log[1]).toMatch(
/Failed running cloud function aFunction for user [^ ]* with:\n {2}Input: {"foo":"bar"}\n {2}Error:/
);
const errorString = JSON.stringify(new Parse.Error(141, 'it failed!'));
const errorString = JSON.stringify(
new Parse.Error(Parse.Error.SCRIPT_FAILED, 'it failed!')
);
expect(log[1].indexOf(errorString)).toBeGreaterThan(0);
done();
})