Server info proper values (#3933)
* Adds failing test * Makes sure booleans are proper booleans * nits * Double negate so it also takes care of null
This commit is contained in:
@@ -164,6 +164,102 @@ describe('server', () => {
|
||||
})
|
||||
});
|
||||
|
||||
it('can properly sets the push support', done => {
|
||||
// default config passes push options
|
||||
const config = new Config('test');
|
||||
expect(config.hasPushSupport).toEqual(true);
|
||||
expect(config.hasPushScheduledSupport).toEqual(false);
|
||||
request.get({
|
||||
url: 'http://localhost:8378/1/serverInfo',
|
||||
headers: {
|
||||
'X-Parse-Application-Id': 'test',
|
||||
'X-Parse-Master-Key': 'test',
|
||||
},
|
||||
json: true,
|
||||
}, (error, response, body) => {
|
||||
expect(body.features.push.immediatePush).toEqual(true);
|
||||
expect(body.features.push.scheduledPush).toEqual(false);
|
||||
done();
|
||||
})
|
||||
});
|
||||
|
||||
it('can properly sets the push support when not configured', done => {
|
||||
reconfigureServer({
|
||||
push: undefined // force no config
|
||||
}).then(() => {
|
||||
const config = new Config('test');
|
||||
expect(config.hasPushSupport).toEqual(false);
|
||||
expect(config.hasPushScheduledSupport).toEqual(false);
|
||||
request.get({
|
||||
url: 'http://localhost:8378/1/serverInfo',
|
||||
headers: {
|
||||
'X-Parse-Application-Id': 'test',
|
||||
'X-Parse-Master-Key': 'test',
|
||||
},
|
||||
json: true,
|
||||
}, (error, response, body) => {
|
||||
expect(body.features.push.immediatePush).toEqual(false);
|
||||
expect(body.features.push.scheduledPush).toEqual(false);
|
||||
done();
|
||||
})
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it('can properly sets the push support ', done => {
|
||||
reconfigureServer({
|
||||
push: {
|
||||
adapter: {
|
||||
send() {},
|
||||
getValidPushTypes() {}
|
||||
}
|
||||
}
|
||||
}).then(() => {
|
||||
const config = new Config('test');
|
||||
expect(config.hasPushSupport).toEqual(true);
|
||||
expect(config.hasPushScheduledSupport).toEqual(false);
|
||||
request.get({
|
||||
url: 'http://localhost:8378/1/serverInfo',
|
||||
headers: {
|
||||
'X-Parse-Application-Id': 'test',
|
||||
'X-Parse-Master-Key': 'test',
|
||||
},
|
||||
json: true,
|
||||
}, (error, response, body) => {
|
||||
expect(body.features.push.immediatePush).toEqual(true);
|
||||
expect(body.features.push.scheduledPush).toEqual(false);
|
||||
done();
|
||||
})
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it('can properly sets the push schedule support', done => {
|
||||
reconfigureServer({
|
||||
push: {
|
||||
adapter: {
|
||||
send() {},
|
||||
getValidPushTypes() {}
|
||||
}
|
||||
},
|
||||
scheduledPush: true,
|
||||
}).then(() => {
|
||||
const config = new Config('test');
|
||||
expect(config.hasPushSupport).toEqual(true);
|
||||
expect(config.hasPushScheduledSupport).toEqual(true);
|
||||
request.get({
|
||||
url: 'http://localhost:8378/1/serverInfo',
|
||||
headers: {
|
||||
'X-Parse-Application-Id': 'test',
|
||||
'X-Parse-Master-Key': 'test',
|
||||
},
|
||||
json: true,
|
||||
}, (error, response, body) => {
|
||||
expect(body.features.push.immediatePush).toEqual(true);
|
||||
expect(body.features.push.scheduledPush).toEqual(true);
|
||||
done();
|
||||
})
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it('can respond 200 on path health', done => {
|
||||
request.get({
|
||||
url: 'http://localhost:8378/1/health',
|
||||
|
||||
@@ -181,9 +181,8 @@ class ParseServer {
|
||||
// We pass the options and the base class for the adatper,
|
||||
// Note that passing an instance would work too
|
||||
const pushController = new PushController();
|
||||
|
||||
const hasPushSupport = pushAdapter && push;
|
||||
const hasPushScheduledSupport = pushAdapter && push && scheduledPush;
|
||||
const hasPushSupport = !!(pushAdapter && push);
|
||||
const hasPushScheduledSupport = hasPushSupport && (scheduledPush === true);
|
||||
|
||||
const {
|
||||
disablePushWorker
|
||||
|
||||
Reference in New Issue
Block a user