2013-10-10 16:59:19 +08:00
|
|
|
|
2013-10-15 16:40:31 +08:00
|
|
|
var json, url;
|
|
|
|
module('provider.json')
|
|
|
|
QUnit.testStart(function() {
|
|
|
|
json = new torque.providers.json({
|
2013-10-17 21:51:12 +08:00
|
|
|
table: 'test',
|
2013-10-10 16:59:19 +08:00
|
|
|
user: "rambo",
|
|
|
|
resolution: 1,
|
2013-10-15 16:40:31 +08:00
|
|
|
steps: 10,
|
|
|
|
extra_params: {
|
|
|
|
testing: 'abcd%'
|
|
|
|
}
|
2013-10-10 16:59:19 +08:00
|
|
|
});
|
2013-10-15 16:40:31 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
test("url", function() {
|
2013-10-10 16:59:19 +08:00
|
|
|
equal("http://rambo.cartodb.com/api/v2/sql", json.url());
|
|
|
|
});
|
|
|
|
|
2013-10-15 16:40:31 +08:00
|
|
|
test("extra_params", function() {
|
|
|
|
var url = "http://rambo.cartodb.com/api/v2/sql?q=1&testing=abcd%25";
|
|
|
|
json.sql('1');
|
|
|
|
equal(torque.net.lastCall().url, url);
|
|
|
|
});
|
|
|
|
|
2013-10-17 21:51:12 +08:00
|
|
|
test("getSQL", function() {
|
|
|
|
var s;
|
|
|
|
equal(json.getSQL(), "select * from test");
|
|
|
|
json.setSQL(s='select * from test limit 10');
|
|
|
|
equal(json.getSQL(), s);
|
|
|
|
json.setSQL(null);
|
|
|
|
equal(json.getSQL(), "select * from test");
|
|
|
|
});
|
|
|
|
|
2013-10-10 16:59:19 +08:00
|
|
|
|
|
|
|
|