Skip to content

refactor: error messages reformatted and moved into own files (#1731) #7446

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 87 commits into
base: alpha
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
23144a4
Error message formatting on server
faisal154 Jun 25, 2021
4ad1fa3
removed formatting issue
faisal154 Jun 28, 2021
704aba2
Merge branch 'master' into feat/1731
fn-faisal Aug 31, 2021
1808b4d
refactor -- 1
faisal154 Sep 1, 2021
e5554db
Merge branch 'feat/1731' of https://github.com/fn-faisal/parse-server…
faisal154 Sep 1, 2021
ca90aa5
refactor -- 2
faisal154 Sep 1, 2021
af0f8cd
refactor -- 3
faisal154 Sep 1, 2021
c52f6ed
refactor -- 4
faisal154 Sep 1, 2021
fa2c14a
Merge branch 'master' into feat/1731
mtrezza Sep 10, 2021
d6593a0
Merge branch 'master' into feat/1731
fn-faisal Sep 13, 2021
5a9ddad
Merge branch 'master' into feat/1731
mtrezza Sep 20, 2021
be4652d
CHANGELOG entry + removed . at the end of errors
faisal154 Sep 21, 2021
8475b93
updated specs
faisal154 Sep 21, 2021
30b526b
updated error message 2
faisal154 Sep 21, 2021
650f459
Merge branch 'master' into feat/1731
fn-faisal Sep 28, 2021
c21cef2
Added dot at the end of messages
faisal154 Sep 29, 2021
156477c
dot at the end of messages -- 2
faisal154 Sep 29, 2021
afe71e3
Merge branch 'master' into feat/1731
mtrezza Sep 29, 2021
8e1276e
Merge branch 'master' into feat/1731
mtrezza Oct 6, 2021
97fe795
url comparison spec file fix
faisal154 Oct 7, 2021
076c012
fixing spec -- 2
faisal154 Oct 7, 2021
6135d24
fixing spec -- 3
faisal154 Oct 7, 2021
11dad3b
fixed error messages
faisal154 Oct 11, 2021
063e159
Merge branch 'master' of https://github.com/parse-community/parse-ser…
faisal154 Oct 11, 2021
8cc1639
Merge branch 'master' into feat/1731
mtrezza Oct 14, 2021
3b6d10a
Merge branch 'master' into feat/1731
mtrezza Oct 17, 2021
e30d8fe
Merge branch 'master' into feat/1731
mtrezza Oct 18, 2021
2bfd428
fixed error
faisal154 Oct 19, 2021
1981917
Merge branch 'feat/1731' of https://github.com/fn-faisal/parse-server…
faisal154 Oct 19, 2021
dd52f9e
test fixes -- 2
faisal154 Oct 19, 2021
625869d
error fix
faisal154 Oct 20, 2021
3529110
error message revert
faisal154 Oct 20, 2021
f5f0552
error message revert -- 2
faisal154 Oct 20, 2021
90224a1
fix error messages
faisal154 Oct 20, 2021
ad66ca7
updated testcase for notContainedIn false queries
faisal154 Nov 23, 2021
84d5476
resolve merge conflicts
faisal154 Nov 23, 2021
cf48d0e
fix typo
faisal154 Nov 23, 2021
7cc12dc
workarounds for postgres tests
faisal154 Nov 23, 2021
0be0d92
Merge branch 'alpha' of https://github.com/parse-community/parse-serv…
faisal154 Nov 29, 2021
2682010
workaround 1
faisal154 Nov 29, 2021
cef6759
fixes for pgsql tests
faisal154 Nov 29, 2021
7718100
fixes for pgsql tests
faisal154 Nov 29, 2021
78e5a22
Merge branch 'alpha' of https://github.com/parse-community/parse-serv…
faisal154 Nov 29, 2021
5980886
Merge branch 'alpha' into feat/1731
fn-faisal Nov 30, 2021
3c06771
removed if checks for postgres
faisal154 Nov 30, 2021
04b34b4
Merge branch 'feat/1731' of https://github.com/fn-faisal/parse-server…
faisal154 Nov 30, 2021
4051280
fix: error message type fix
faisal154 Nov 30, 2021
f0ce64b
fix: error message to camel case
faisal154 Dec 1, 2021
685e7ee
fix: revert testcase for containedBy invalid query
faisal154 Dec 1, 2021
c0994c4
update reqOp and noOp message The -> The field
faisal154 Dec 1, 2021
548726d
fix: refactor 1
faisal154 Dec 1, 2021
fd56eb1
fix: Error Message refactor
faisal154 Dec 1, 2021
25494d1
fix: import ErrorMessage
faisal154 Dec 1, 2021
850fd2a
fix: import ErrorMessage -- 2
faisal154 Dec 1, 2021
caa2aaf
fix: ValidationAndPasswordsReset spec file fix
faisal154 Dec 1, 2021
11d1150
fix: use ErrorMessage object in ValidationAndPasswordReset spec
faisal154 Dec 2, 2021
9886a4e
fix: test fix for EmailVerificationToken spec
faisal154 Dec 2, 2021
f10be87
fix: failing test fixes for ParseUser spec
faisal154 Dec 2, 2021
8946459
fix: failing test cases AccountLockoutPolicy spec
faisal154 Dec 2, 2021
2c35bdd
fix: refactor accountLockout string to ErrorMessage
faisal154 Dec 2, 2021
e41c58a
fix: failing test case for ParseServerRESTController spec
faisal154 Dec 2, 2021
991b04d
fix: schema spec failing test cases
faisal154 Dec 2, 2021
b7d6e1c
fix: failing test cases for VerifyUserPassword spec
faisal154 Dec 2, 2021
9b52bd0
fix: failing test cases rest spec
faisal154 Dec 2, 2021
22a0992
fix: RestQuery spec failing test non-exitent class
faisal154 Dec 2, 2021
abfe5e5
fix: RestQuery to use ErrorMessage for class creation err
faisal154 Dec 2, 2021
5385bc6
fix: ParseQyery spec
faisal154 Dec 2, 2021
4a0fd8f
fix: ParseQuery.FullTextSearch test case fix
faisal154 Dec 2, 2021
7a3c956
fix: ParseQuery.FullTextSearch spec failing errors
faisal154 Dec 2, 2021
1c26f88
fix: ParseQuery.FullTextSearch spec failing errors -- 2
faisal154 Dec 2, 2021
ff34daa
fix: invalidJson test fix --1
faisal154 Dec 2, 2021
e873e3c
fix: ParseQuery.FullTextSerach spec test cases for pgsql
faisal154 Dec 2, 2021
769b69f
fix: PostgresStorageAdapter error :
faisal154 Dec 2, 2021
3a722e4
fix: added test cases for ErrorMessage
faisal154 Dec 2, 2021
6e58086
fix: removed test cases for ErrorMessage
faisal154 Dec 2, 2021
0a9f5e2
fix: refactor queryValueTypeInvalid seperator
faisal154 Dec 6, 2021
8be5fe4
fix: refactor queryValueTypeInvalid key, value
faisal154 Dec 6, 2021
efc1483
fix: failing testcases for mongo
faisal154 Dec 6, 2021
b219124
fix: refactor required op space
faisal154 Dec 6, 2021
d60b4b6
fix: bad renamed to invalid
faisal154 Dec 6, 2021
8e0454c
fix: objectFieldValueInvalid refactor
faisal154 Dec 6, 2021
0d7a80e
Merge branch 'alpha' of https://github.com/parse-community/parse-serv…
faisal154 Dec 14, 2021
12cd379
fix: refactor error messages
faisal154 Dec 14, 2021
5bd8abc
fix: refactor error message
faisal154 Dec 14, 2021
847b966
fix: test cases postgres adapter
faisal154 Dec 14, 2021
c591ad0
Merge branch 'alpha' into feat/1731
fn-faisal Jan 7, 2022
0d6b06a
Merge branch 'alpha' into feat/1731
fn-faisal Jan 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions spec/AccountLockoutPolicy.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
const Config = require('../lib/Config');
const Definitions = require('../lib/Options/Definitions');
const request = require('../lib/request');
const { ErrorMessage } = require('../lib/Errors/message');

const loginWithWrongCredentialsShouldFail = function (username, password) {
return new Promise((resolve, reject) => {
Parse.User.logIn(username, password)
.then(() => reject('login should have failed'))
.catch(err => {
if (err.message === 'Invalid username/password.') {
if (err.message === ErrorMessage.invalid('username/password')) {
resolve();
} else {
reject(err);
Expand All @@ -24,12 +25,7 @@ const isAccountLockoutError = function (username, password, duration, waitTime)
Parse.User.logIn(username, password)
.then(() => reject('login should have failed'))
.catch(err => {
if (
err.message ===
'Your account is locked due to multiple failed login attempts. Please try again after ' +
duration +
' minute(s)'
) {
if (err.message === ErrorMessage.accountLocked(duration)) {
resolve();
} else {
reject(err);
Expand Down
2 changes: 1 addition & 1 deletion spec/AuthenticationAdapters.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ describe('AuthenticationProviders', function () {
})
.then(fail, ({ data }) => {
expect(data.code).toBe(208);
expect(data.error).toBe('this auth is already used');
expect(data.error).toBe('This auth is already used.');
done();
})
.catch(done.fail);
Expand Down
3 changes: 2 additions & 1 deletion spec/EmailVerificationToken.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const Config = require('../lib/Config');
const request = require('../lib/request');
const { ErrorMessage } = require('../lib/Errors/message');

describe('Email Verification Token Expiration: ', () => {
it('show the invalid verification link page, if the user clicks on the verify email link after the email verify token expires', done => {
Expand Down Expand Up @@ -848,7 +849,7 @@ describe('Email Verification Token Expiration: ', () => {
.then(response => {
expect(response.status).toBe(400);
expect(response.data.code).toBe(Parse.Error.EMAIL_MISSING);
expect(response.data.error).toBe('you must provide an email');
expect(response.data.error).toBe(ErrorMessage.required('email'));
expect(sendVerificationEmailCallCount).toBe(0);
expect(sendEmailOptions).not.toBeDefined();
done();
Expand Down
48 changes: 24 additions & 24 deletions spec/ParseGraphQLServer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4188,7 +4188,7 @@ describe('ParseGraphQLServer', () => {
.slice(0, 3)
.map(obj =>
expectAsync(getObject(obj.className, obj.id)).toBeRejectedWith(
jasmine.stringMatching('Object not found')
jasmine.stringMatching('Object not found.')
)
)
);
Expand Down Expand Up @@ -4232,7 +4232,7 @@ describe('ParseGraphQLServer', () => {
getObject(object2.className, object2.id, {
'X-Parse-Session-Token': user3.getSessionToken(),
})
).toBeRejectedWith(jasmine.stringMatching('Object not found'));
).toBeRejectedWith(jasmine.stringMatching('Object not found.'));
await Promise.all(
[object1, object3, object4].map(async obj =>
expect(
Expand All @@ -4250,7 +4250,7 @@ describe('ParseGraphQLServer', () => {
getObject(obj.className, obj.id, {
'X-Parse-Session-Token': user4.getSessionToken(),
})
).toBeRejectedWith(jasmine.stringMatching('Object not found'))
).toBeRejectedWith(jasmine.stringMatching('Object not found.'))
)
);
expect(
Expand All @@ -4266,7 +4266,7 @@ describe('ParseGraphQLServer', () => {
getObject(obj.className, obj.id, {
'X-Parse-Session-Token': user5.getSessionToken(),
})
).toBeRejectedWith(jasmine.stringMatching('Object not found'))
).toBeRejectedWith(jasmine.stringMatching('Object not found.'))
)
);
expect(
Expand Down Expand Up @@ -6036,7 +6036,7 @@ describe('ParseGraphQLServer', () => {
updateObject(obj.className, obj.id, {
someField: 'changedValue1',
})
).toBeRejectedWith(jasmine.stringMatching('Object not found'));
).toBeRejectedWith(jasmine.stringMatching('Object not found.'));
await obj.fetch({ useMasterKey: true });
expect(obj.get('someField')).toEqual(originalFieldValue);
})
Expand Down Expand Up @@ -6122,7 +6122,7 @@ describe('ParseGraphQLServer', () => {
{ someField: 'changedValue5' },
{ 'X-Parse-Session-Token': user3.getSessionToken() }
)
).toBeRejectedWith(jasmine.stringMatching('Object not found'));
).toBeRejectedWith(jasmine.stringMatching('Object not found.'));
await object2.fetch({ useMasterKey: true });
expect(object2.get('someField')).toEqual(originalFieldValue);
await Promise.all(
Expand All @@ -6135,7 +6135,7 @@ describe('ParseGraphQLServer', () => {
{ someField: 'changedValue6' },
{ 'X-Parse-Session-Token': user4.getSessionToken() }
)
).toBeRejectedWith(jasmine.stringMatching('Object not found'));
).toBeRejectedWith(jasmine.stringMatching('Object not found.'));
await obj.fetch({ useMasterKey: true });
expect(obj.get('someField')).toEqual(originalFieldValue);
})
Expand All @@ -6162,7 +6162,7 @@ describe('ParseGraphQLServer', () => {
{ someField: 'changedValue7' },
{ 'X-Parse-Session-Token': user5.getSessionToken() }
)
).toBeRejectedWith(jasmine.stringMatching('Object not found'));
).toBeRejectedWith(jasmine.stringMatching('Object not found.'));
await obj.fetch({ useMasterKey: true });
expect(obj.get('someField')).toEqual(originalFieldValue);
})
Expand Down Expand Up @@ -6234,7 +6234,7 @@ describe('ParseGraphQLServer', () => {
updateObject(obj.className, obj.id, {
someField: 'changedValue1',
})
).toBeRejectedWith(jasmine.stringMatching('Object not found'));
).toBeRejectedWith(jasmine.stringMatching('Object not found.'));
await obj.fetch({ useMasterKey: true });
expect(obj.get('someField')).toEqual(originalFieldValue);
})
Expand Down Expand Up @@ -6330,7 +6330,7 @@ describe('ParseGraphQLServer', () => {
{ someField: 'changedValue5' },
{ 'X-Parse-Session-Token': user3.getSessionToken() }
)
).toBeRejectedWith(jasmine.stringMatching('Object not found'));
).toBeRejectedWith(jasmine.stringMatching('Object not found.'));
await object2.fetch({ useMasterKey: true });
expect(object2.get('someField')).toEqual(originalFieldValue);
await Promise.all(
Expand All @@ -6343,7 +6343,7 @@ describe('ParseGraphQLServer', () => {
{ someField: 'changedValue6' },
{ 'X-Parse-Session-Token': user4.getSessionToken() }
)
).toBeRejectedWith(jasmine.stringMatching('Object not found'));
).toBeRejectedWith(jasmine.stringMatching('Object not found.'));
await obj.fetch({ useMasterKey: true });
expect(obj.get('someField')).toEqual(originalFieldValue);
})
Expand Down Expand Up @@ -6372,7 +6372,7 @@ describe('ParseGraphQLServer', () => {
{ someField: 'changedValue7' },
{ 'X-Parse-Session-Token': user5.getSessionToken() }
)
).toBeRejectedWith(jasmine.stringMatching('Object not found'));
).toBeRejectedWith(jasmine.stringMatching('Object not found.'));
await obj.fetch({ useMasterKey: true });
expect(obj.get('someField')).toEqual(originalFieldValue);
})
Expand Down Expand Up @@ -6446,7 +6446,7 @@ describe('ParseGraphQLServer', () => {
expect(result.data.deleteCustomer.customer.someField2).toEqual('someField2Value1');

await expectAsync(obj.fetch({ useMasterKey: true })).toBeRejectedWith(
jasmine.stringMatching('Object not found')
jasmine.stringMatching('Object not found.')
);
});

Expand Down Expand Up @@ -6482,7 +6482,7 @@ describe('ParseGraphQLServer', () => {
objects.slice(0, 3).map(async obj => {
const originalFieldValue = obj.get('someField');
await expectAsync(deleteObject(obj.className, obj.id)).toBeRejectedWith(
jasmine.stringMatching('Object not found')
jasmine.stringMatching('Object not found.')
);
await obj.fetch({ useMasterKey: true });
expect(obj.get('someField')).toEqual(originalFieldValue);
Expand All @@ -6495,7 +6495,7 @@ describe('ParseGraphQLServer', () => {
deleteObject(obj.className, obj.id, {
'X-Parse-Session-Token': user4.getSessionToken(),
})
).toBeRejectedWith(jasmine.stringMatching('Object not found'));
).toBeRejectedWith(jasmine.stringMatching('Object not found.'));
await obj.fetch({ useMasterKey: true });
expect(obj.get('someField')).toEqual(originalFieldValue);
})
Expand All @@ -6506,7 +6506,7 @@ describe('ParseGraphQLServer', () => {
]
).toEqual({ objectId: object4.id, __typename: 'PublicClass' });
await expectAsync(object4.fetch({ useMasterKey: true })).toBeRejectedWith(
jasmine.stringMatching('Object not found')
jasmine.stringMatching('Object not found.')
);
expect(
(
Expand All @@ -6516,7 +6516,7 @@ describe('ParseGraphQLServer', () => {
).data.delete[object1.className.charAt(0).toLowerCase() + object1.className.slice(1)]
).toEqual({ objectId: object1.id, __typename: 'GraphQLClass' });
await expectAsync(object1.fetch({ useMasterKey: true })).toBeRejectedWith(
jasmine.stringMatching('Object not found')
jasmine.stringMatching('Object not found.')
);
expect(
(
Expand All @@ -6526,7 +6526,7 @@ describe('ParseGraphQLServer', () => {
).data.delete[object2.className.charAt(0).toLowerCase() + object2.className.slice(1)]
).toEqual({ objectId: object2.id, __typename: 'GraphQLClass' });
await expectAsync(object2.fetch({ useMasterKey: true })).toBeRejectedWith(
jasmine.stringMatching('Object not found')
jasmine.stringMatching('Object not found.')
);
expect(
(
Expand All @@ -6536,7 +6536,7 @@ describe('ParseGraphQLServer', () => {
).data.delete[object3.className.charAt(0).toLowerCase() + object3.className.slice(1)]
).toEqual({ objectId: object3.id, __typename: 'GraphQLClass' });
await expectAsync(object3.fetch({ useMasterKey: true })).toBeRejectedWith(
jasmine.stringMatching('Object not found')
jasmine.stringMatching('Object not found.')
);
});

Expand Down Expand Up @@ -6572,7 +6572,7 @@ describe('ParseGraphQLServer', () => {
objects.slice(0, 3).map(async obj => {
const originalFieldValue = obj.get('someField');
await expectAsync(deleteObject(obj.className, obj.id)).toBeRejectedWith(
jasmine.stringMatching('Object not found')
jasmine.stringMatching('Object not found.')
);
await obj.fetch({ useMasterKey: true });
expect(obj.get('someField')).toEqual(originalFieldValue);
Expand All @@ -6585,7 +6585,7 @@ describe('ParseGraphQLServer', () => {
deleteObject(obj.className, obj.id, {
'X-Parse-Session-Token': user4.getSessionToken(),
})
).toBeRejectedWith(jasmine.stringMatching('Object not found'));
).toBeRejectedWith(jasmine.stringMatching('Object not found.'));
await obj.fetch({ useMasterKey: true });
expect(obj.get('someField')).toEqual(originalFieldValue);
})
Expand All @@ -6596,7 +6596,7 @@ describe('ParseGraphQLServer', () => {
][object4.className.charAt(0).toLowerCase() + object4.className.slice(1)].objectId
).toEqual(object4.id);
await expectAsync(object4.fetch({ useMasterKey: true })).toBeRejectedWith(
jasmine.stringMatching('Object not found')
jasmine.stringMatching('Object not found.')
);
expect(
(
Expand All @@ -6608,7 +6608,7 @@ describe('ParseGraphQLServer', () => {
].objectId
).toEqual(object1.id);
await expectAsync(object1.fetch({ useMasterKey: true })).toBeRejectedWith(
jasmine.stringMatching('Object not found')
jasmine.stringMatching('Object not found.')
);
expect(
(
Expand All @@ -6632,7 +6632,7 @@ describe('ParseGraphQLServer', () => {
].objectId
).toEqual(object3.id);
await expectAsync(object3.fetch({ useMasterKey: true })).toBeRejectedWith(
jasmine.stringMatching('Object not found')
jasmine.stringMatching('Object not found.')
);
});
});
Expand Down
4 changes: 3 additions & 1 deletion spec/ParseInstallation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,9 @@ describe('Installations', () => {
},
err => {
expect(err.code).toBe(136);
expect(err.message).toBe('installationId may not be changed in this operation');
expect(err.message).toBe(
'The field installationId can not be changed in this operation.'
);
done();
}
);
Expand Down
21 changes: 17 additions & 4 deletions spec/ParseQuery.FullTextSearch.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const Config = require('../lib/Config');
const Parse = require('parse/node');
const request = require('../lib/request');
const { ErrorMessage } = require('../lib/Errors/message');
let databaseAdapter;

const fullTextHelper = async () => {
Expand Down Expand Up @@ -110,7 +111,10 @@ describe('Parse.Query Full Text Search testing', () => {
}
};
await expectAsync(invalidQuery()).toBeRejectedWith(
new Parse.Error(Parse.Error.INVALID_JSON, 'bad $text: $search, should be object')
new Parse.Error(
Parse.Error.INVALID_JSON,
ErrorMessage.queryValueTypeInvalid('object', '$text.$search')
)
);
});

Expand All @@ -119,7 +123,10 @@ describe('Parse.Query Full Text Search testing', () => {
const query = new Parse.Query('TestObject');
query.fullText('subject', 'leche', { language: true });
await expectAsync(query.find()).toBeRejectedWith(
new Parse.Error(Parse.Error.INVALID_JSON, 'bad $text: $language, should be string')
new Parse.Error(
Parse.Error.INVALID_JSON,
ErrorMessage.queryValueTypeInvalid('string', '$text.$language')
)
);
});

Expand All @@ -128,7 +135,10 @@ describe('Parse.Query Full Text Search testing', () => {
const query = new Parse.Query('TestObject');
query.fullText('subject', 'leche', { caseSensitive: 'string' });
await expectAsync(query.find()).toBeRejectedWith(
new Parse.Error(Parse.Error.INVALID_JSON, 'bad $text: $caseSensitive, should be boolean')
new Parse.Error(
Parse.Error.INVALID_JSON,
ErrorMessage.queryValueTypeInvalid('boolean', '$text.$caseSensitive')
)
);
});

Expand All @@ -137,7 +147,10 @@ describe('Parse.Query Full Text Search testing', () => {
const query = new Parse.Query('TestObject');
query.fullText('subject', 'leche', { diacriticSensitive: 'string' });
await expectAsync(query.find()).toBeRejectedWith(
new Parse.Error(Parse.Error.INVALID_JSON, 'bad $text: $diacriticSensitive, should be boolean')
new Parse.Error(
Parse.Error.INVALID_JSON,
ErrorMessage.queryValueTypeInvalid('boolean', '$text.$diacriticSensitive')
)
);
});
});
Expand Down
7 changes: 4 additions & 3 deletions spec/ParseQuery.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
'use strict';

const Parse = require('parse/node');
const { ErrorMessage } = require('../lib/Errors/message');
const request = require('../lib/request');

const masterKeyHeaders = {
Expand Down Expand Up @@ -980,7 +981,7 @@ describe('Parse.Query testing', () => {
.then(done.fail)
.catch(response => {
equal(response.data.code, Parse.Error.INVALID_JSON);
equal(response.data.error, 'bad $containedBy: should be an array');
equal(response.data.error, ErrorMessage.queryValueTypeInvalid('an array', '$containedBy'));
done();
});
});
Expand Down Expand Up @@ -1319,7 +1320,7 @@ describe('Parse.Query testing', () => {
.then(done.fail)
.catch(error => {
equal(error.code, Parse.Error.INVALID_JSON);
equal(error.message, 'bad $in value');
equal(error.message, ErrorMessage.objectFieldValueInvalid('$in'));
done();
});
});
Expand All @@ -1339,7 +1340,7 @@ describe('Parse.Query testing', () => {
.then(done.fail)
.catch(error => {
equal(error.code, Parse.Error.INVALID_JSON);
equal(error.message, 'bad $nin value');
equal(error.message, ErrorMessage.objectFieldValueInvalid('$nin'));
done();
});
});
Expand Down
5 changes: 3 additions & 2 deletions spec/ParseServerRESTController.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const ParseServer = require('../lib/ParseServer').default;
const Parse = require('parse/node').Parse;
const semver = require('semver');
const TestUtils = require('../lib/TestUtils');
const { ErrorMessage } = require('../lib/Errors/message');

let RESTController;

Expand Down Expand Up @@ -569,7 +570,7 @@ describe('ParseServerRESTController', () => {
fail('Success callback should not be called when passing an empty username.');
} catch (err) {
expect(err.code).toBe(Parse.Error.USERNAME_MISSING);
expect(err.message).toBe('bad or missing username');
expect(err.message).toBe(ErrorMessage.required('username', ''));
}
});

Expand All @@ -582,7 +583,7 @@ describe('ParseServerRESTController', () => {
fail('Success callback should not be called when passing an empty password.');
} catch (err) {
expect(err.code).toBe(Parse.Error.PASSWORD_MISSING);
expect(err.message).toBe('password is required');
expect(err.message).toBe(ErrorMessage.required('password', ''));
}
});

Expand Down
Loading