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:
Daniel
2023-01-09 04:23:01 +11:00
committed by GitHub
parent 76c7a6fbd0
commit ffa4974158
3 changed files with 53 additions and 37 deletions

View File

@@ -546,6 +546,12 @@ describe('server', () => {
const health = await request({
url: 'http://localhost:12701/parse/health',
}).catch(e => e);
spyOn(console, 'warn').and.callFake(() => {});
const verify = await ParseServer.default.verifyServerUrl();
expect(verify).not.toBeTrue();
expect(console.warn).toHaveBeenCalledWith(
`\nWARNING, Unable to connect to 'http://localhost:12701/parse'. Cloud code and push notifications may be unavailable!\n`
);
expect(health.data.status).toBe('initialized');
expect(health.status).toBe(503);
await new Promise(resolve => server.close(resolve));
@@ -573,6 +579,8 @@ describe('server', () => {
expect(health.data.status).toBe('starting');
expect(health.status).toBe(503);
expect(health.headers['retry-after']).toBe('1');
const response = await ParseServer.default.verifyServerUrl();
expect(response).toBeTrue();
await startingPromise;
await new Promise(resolve => server.close(resolve));
});