implement e2e specs for #155

This commit is contained in:
Sefa Ilkimen 2020-01-27 02:09:21 +01:00
parent aded59e3d1
commit 588e4a0e57
No known key found for this signature in database
GPG Key ID: 4AB0B60A9B5E59F5

View File

@ -869,6 +869,27 @@ const tests = [
parsed.data.should.be.equal('data:application/octet-stream;base64,' + b64Logo);
}
},
{
description: 'should perform an OPTIONS request correctly #155',
expected: 'resolved: {"status":200,"headers":{"allow":"GET, PUT, DELETE, HEAD, PATCH, TRACE, POST, OPTIONS" ...',
func: function (resolve, reject) { cordova.plugin.http.options('http://httpbin.org/anything', {}, {}, resolve, reject); },
validationFunc: function (driver, result) {
result.type.should.be.equal('resolved');
result.data.status.should.be.equal(200);
result.data.headers.should.be.an('object');
result.data.headers.allow.should.include('GET');
result.data.headers.allow.should.include('PUT');
result.data.headers.allow.should.include('DELETE');
result.data.headers.allow.should.include('HEAD');
result.data.headers.allow.should.include('PATCH');
result.data.headers.allow.should.include('TRACE');
result.data.headers.allow.should.include('POST');
result.data.headers.allow.should.include('OPTIONS');
result.data.headers['access-control-allow-origin'].should.be.equal('*');
}
},
// TODO: not ready yet
// {