THRIFT-3627 fix missing basic code style consistency of JavaScript.
Client: js
This closes #858
This closes #1243
diff --git a/lib/js/test/test-jq.js b/lib/js/test/test-jq.js
index 23ed60f..d8649a0 100644
--- a/lib/js/test/test-jq.js
+++ b/lib/js/test/test-jq.js
@@ -33,27 +33,27 @@
//////////////////////////////////
//jQuery asynchronous tests
jQuery.ajaxSetup({ timeout: 0 });
-$(document).ajaxError( function() { QUnit.start(); } );
+$(document).ajaxError(function() { QUnit.start(); });
-module("jQ Async Manual");
+module('jQ Async Manual');
- test("testI32", function() {
- expect( 2 );
+ test('testI32', function() {
+ expect(2);
QUnit.stop();
var transport = new Thrift.Transport();
- var protocol = new Thrift.Protocol(transport);
- var client = new ThriftTest.ThriftTestClient(protocol);
+ var protocol = new Thrift.Protocol(transport);
+ var client = new ThriftTest.ThriftTestClient(protocol);
var jqxhr = jQuery.ajax({
- url: "/service",
- data: client.send_testI32(Math.pow(-2,31)),
- type: "POST",
+ url: '/service',
+ data: client.send_testI32(Math.pow(-2, 31)),
+ type: 'POST',
cache: false,
- dataType: "text",
- success: function(res){
- transport.setRecvBuffer( res );
- equal(client.recv_testI32(), Math.pow(-2,31));
+ dataType: 'text',
+ success: function(res) {
+ transport.setRecvBuffer(res);
+ equal(client.recv_testI32(), Math.pow(-2, 31));
},
error: function() { ok(false); },
complete: function() {
@@ -63,25 +63,25 @@
});
});
- test("testI64", function() {
- expect( 2 );
+ test('testI64', function() {
+ expect(2);
QUnit.stop();
var transport = new Thrift.Transport();
- var protocol = new Thrift.Protocol(transport);
- var client = new ThriftTest.ThriftTestClient(protocol);
+ var protocol = new Thrift.Protocol(transport);
+ var client = new ThriftTest.ThriftTestClient(protocol);
jQuery.ajax({
- url: "/service",
+ url: '/service',
//This is usually 2^61 but JS cannot represent anything over 2^52 accurately
- data: client.send_testI64(Math.pow(-2,52)),
- type: "POST",
+ data: client.send_testI64(Math.pow(-2, 52)),
+ type: 'POST',
cache: false,
- dataType: "text",
- success: function(res){
- transport.setRecvBuffer( res );
+ dataType: 'text',
+ success: function(res) {
+ transport.setRecvBuffer(res);
//This is usually 2^61 but JS cannot represent anything over 2^52 accurately
- equal(client.recv_testI64(), Math.pow(-2,52));
+ equal(client.recv_testI64(), Math.pow(-2, 52));
},
error: function() { ok(false); },
complete: function() {
@@ -92,46 +92,46 @@
});
-module("jQ Async");
- test("I32", function() {
- expect( 3 );
+module('jQ Async');
+ test('I32', function() {
+ expect(3);
QUnit.stop();
- client.testI32(Math.pow(2,30), function(result) {
- equal(result, Math.pow(2,30));
+ client.testI32(Math.pow(2, 30), function(result) {
+ equal(result, Math.pow(2, 30));
QUnit.start();
});
QUnit.stop();
- var jqxhr = client.testI32(Math.pow(-2,31), function(result) {
- equal(result, Math.pow(-2,31));
+ var jqxhr = client.testI32(Math.pow(-2, 31), function(result) {
+ equal(result, Math.pow(-2, 31));
});
jqxhr.success(function(result) {
- equal(result, Math.pow(-2,31));
+ equal(result, Math.pow(-2, 31));
QUnit.start();
});
});
- test("I64", function() {
- expect( 4 );
+ test('I64', function() {
+ expect(4);
QUnit.stop();
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
- client.testI64(Math.pow(2,52), function(result) {
- equal(result, Math.pow(2,52));
+ client.testI64(Math.pow(2, 52), function(result) {
+ equal(result, Math.pow(2, 52));
QUnit.start();
});
QUnit.stop();
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
- client.testI64(Math.pow(-2,52), function(result) {
- equal(result, Math.pow(-2,52));
+ client.testI64(Math.pow(-2, 52), function(result) {
+ equal(result, Math.pow(-2, 52));
})
- .error( function(xhr, status, e) { ok(false, e.message); } )
+ .error(function(xhr, status, e) { ok(false, e.message); })
.success(function(result) {
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
- equal(result, Math.pow(-2,52));
+ equal(result, Math.pow(-2, 52));
})
.complete(function() {
ok(true);
@@ -139,18 +139,18 @@
});
});
- test("Xception", function() {
- expect( 2 );
+ test('Xception', function() {
+ expect(2);
QUnit.stop();
- var dfd = client.testException("Xception", function(result) {
+ var dfd = client.testException('Xception', function(result) {
ok(false);
QUnit.start();
})
- .error(function(xhr, status, e){
+ .error(function(xhr, status, e) {
equal(e.errorCode, 1001);
- equal(e.message, "Xception");
+ equal(e.message, 'Xception');
//QUnit.start();
//Note start is not required here because:
//$(document).ajaxError( function() { QUnit.start(); } );