feat: Adapt verifyServerUrl for new asynchronous Parse Server start-up states (#8366)
BREAKING CHANGE: The method `ParseServer.verifyServerUrl` now returns a promise instead of a callback.
This commit is contained in:
@@ -29,27 +29,20 @@ describe('Server Url Checks', () => {
|
||||
server.close(done);
|
||||
});
|
||||
|
||||
it('validate good server url', done => {
|
||||
it('validate good server url', async () => {
|
||||
Parse.serverURL = 'http://localhost:13376';
|
||||
ParseServer.verifyServerUrl(async result => {
|
||||
if (!result) {
|
||||
done.fail('Did not pass valid url');
|
||||
}
|
||||
await reconfigureServer();
|
||||
done();
|
||||
});
|
||||
const response = await ParseServer.verifyServerUrl();
|
||||
expect(response).toBeTrue();
|
||||
});
|
||||
|
||||
it('mark bad server url', done => {
|
||||
it('mark bad server url', async () => {
|
||||
spyOn(console, 'warn').and.callFake(() => {});
|
||||
Parse.serverURL = 'notavalidurl';
|
||||
ParseServer.verifyServerUrl(async result => {
|
||||
if (result) {
|
||||
done.fail('Did not mark invalid url');
|
||||
}
|
||||
await reconfigureServer();
|
||||
done();
|
||||
});
|
||||
const response = await ParseServer.verifyServerUrl();
|
||||
expect(response).not.toBeTrue();
|
||||
expect(console.warn).toHaveBeenCalledWith(
|
||||
`\nWARNING, Unable to connect to 'notavalidurl' as the URL is invalid. Cloud code and push notifications may be unavailable!\n`
|
||||
);
|
||||
});
|
||||
|
||||
xit('handleShutdown, close connection', done => {
|
||||
|
||||
Reference in New Issue
Block a user