Adding a test for HTTP/2

I've never really worked with node before and not sure how to run these
e2e tests, but this is baed on the usage shown on the project's Github

https://github.com/stefanjudis/is-http2
This commit is contained in:
IamTheFij 2017-05-03 17:21:34 +00:00
parent d0bc8b3408
commit 367b22bcff
2 changed files with 15 additions and 0 deletions

View File

@ -20,6 +20,7 @@
"debug": "^2.2.0", "debug": "^2.2.0",
"dns-sync": "^0.1.3", "dns-sync": "^0.1.3",
"imap": "^0.8.17", "imap": "^0.8.17",
"is-http2": "^1.1.0",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"mocha": "^2.2.5", "mocha": "^2.2.5",
"nodemailer": "^2.4.2", "nodemailer": "^2.4.2",

View File

@ -15,6 +15,7 @@ var AppStore = require('../appstore.js'),
Cloudron = require('../cloudron.js'), Cloudron = require('../cloudron.js'),
common = require('../common.js'), common = require('../common.js'),
digitalocean = require('../digitalocean.js'), digitalocean = require('../digitalocean.js'),
ishttp2 = require('is-http2'),
mailer = require('../mailer.js'), mailer = require('../mailer.js'),
rimraf = require('rimraf'), rimraf = require('rimraf'),
semver = require('semver'), semver = require('semver'),
@ -238,6 +239,19 @@ describe('Selfhost DigitalOcean with filesystem backend', function () {
cloudron.checkAddons(cloudron.appFqdn(location), owner); cloudron.checkAddons(cloudron.appFqdn(location), owner);
}); });
it('can access app with http2', function () {
ishttp2(cloudron.appFqdn(location), { includeSpdy: true })
.then(function (result) {
assert(result.isHttp2, 'App was not served with HTTP/2');
if (result.supportedProtocols) {
console.log(`Supported protocols: ${ result.supportedProtocols.join(' ') }`);
}
})
.catch(function (error) {
assert(false, 'Could not verify HTTP/2');
});
});
it('can set appstore config', function () { it('can set appstore config', function () {
var token = appStore.getAccessToken(owner); var token = appStore.getAccessToken(owner);
appStore.setCredentials(owner.password, token); appStore.setCredentials(owner.password, token);