add test for gzipped content

This commit is contained in:
Sefa Ilkimen 2018-09-03 14:18:22 +02:00
parent c8638ff204
commit 91515d30bd
2 changed files with 13 additions and 3 deletions

View File

@ -5,9 +5,9 @@
"scripts": {
"updatecert": "node ./scripts/update-test-cert.js",
"buildbrowser": "./scripts/build-test-app.sh --browser",
"testandroid": "./scripts/build-test-app.sh --android --emulator && ./scripts/test-app.sh --android --emulator",
"testios": "./scripts/build-test-app.sh --ios --emulator && ./scripts/test-app.sh --ios --emulator",
"testapp": "npm run updatecert && npm run testandroid && npm run testios",
"testandroid": "npm run updatecert && ./scripts/build-test-app.sh --android --emulator && ./scripts/test-app.sh --android --emulator",
"testios": "npm run updatecert && ./scripts/build-test-app.sh --ios --emulator && ./scripts/test-app.sh --ios --emulator",
"testapp": "npm run testandroid && npm run testios",
"testjs": "mocha ./test/js-mocha-specs.js",
"test": "npm run testjs && npm run testapp",
"release": "npm run test && ./scripts/release.sh"

View File

@ -435,6 +435,7 @@ const tests = [
},
validationFunc: function(driver, result) {
result.type.should.be.equal('resolved');
result.data.status.should.be.equal(200);
}
},{
description: 'should reject when pinned cert does not match received server cert (GET)',
@ -474,6 +475,15 @@ const tests = [
result.data.status.should.be.equal(403);
result.data.error.should.be.equal('There was an error downloading the file');
}
},{
description: 'should handle gzip encoded response correctly',
expected: 'resolved: {"status": 200, "headers": "{\\"Content-Encoding\\": \\"gzip\\" ...',
func: function(resolve, reject) { cordova.plugin.http.get('http://httpbin.org/gzip', {}, {}, resolve, reject); },
validationFunc: function(driver, result) {
result.type.should.be.equal('resolved');
result.data.status.should.be.equal(200);
JSON.parse(result.data.data).gzipped.should.be.equal(true);
}
}
];