web3.js/test/httpprovider.js

33 lines
889 B
JavaScript
Raw Normal View History

var chai = require('chai');
var assert = chai.assert;
var SandboxedModule = require('sandboxed-module');
var HttpProvider = SandboxedModule.require('../lib/web3/httpprovider', {
requires: {
'xmlhttprequest': require('./FakeXMLHttpRequest')
}
});
describe('httpprovider', function () {
describe('send', function () {
2015-03-21 21:17:24 +00:00
it('should send basic request', function () {
var provider = new HttpProvider();
var result = provider.send({});
2015-03-21 21:17:24 +00:00
assert.equal(typeof result, 'object');
});
});
2015-03-21 21:17:24 +00:00
describe('sendAsync', function () {
it('should send basic async request', function (done) {
var provider = new HttpProvider();
2015-03-21 21:17:24 +00:00
provider.sendAsync({}, function (err, result) {
assert.equal(typeof result, 'object');
done();
});
});
});
});