'use strict';

var assert = require('assert');
var turbocarto = require('../../src/index');
var DummyDatasource = require('../support/dummy-datasource');

describe('range issue', function () {
  it('should generate a valid cartocss for a ramp with only one bucket/value', function (done) {
    var turboCartocss = [
      '#layer{',
      '  marker-width: ramp([cartodb_id], cartocolor(SunsetDark, 10), jenks);',
      '}'
    ].join('\n');
    var expectedCartocss = [
      '#layer{',
      '  marker-width: #fcde9c;',
      '}'
    ].join('\n');
    var datasource = new DummyDatasource(function () {
      return {
        ramp: [5],
        stats: { min_val: 5, max_val: 5, avg_val: 5 }
      };
    });
    turbocarto(turboCartocss, datasource, function (err, result, metadata) {
      if (err) {
        return done(err);
      }

      assert.equal(result, expectedCartocss);
      done();
    });
  });
});

@@ -262,16 +262,33 @@
 et/value
+ and %22%3E%22 strategy
 ', funct
@@ -296,24 +296,24 @@
 on (done) %7B%0A
-
     var turb
@@ -359,21 +359,20 @@
  marker-
-width
+fill
 : ramp(%5B
@@ -516,13 +516,12 @@
 ker-
-width
+fill
 : #f
@@ -784,18 +784,740 @@
 sult
-, metadata
+) %7B%0A      if (err) %7B%0A        return done(err);%0A      %7D%0A%0A      assert.equal(result, expectedCartocss);%0A      done();%0A    %7D);%0A  %7D);%0A%0A  it('should generate a valid cartocss for a ramp with only one bucket/value and %22%3C%22 strategy', function (done) %7B%0A    var turboCartocss = %5B%0A      '#layer%7B',%0A      '  marker-fill: ramp(%5Bcartodb_id%5D, cartocolor(SunsetDark, 10), headtails(1));',%0A      '%7D'%0A    %5D.join('%5Cn');%0A    var expectedCartocss = %5B%0A      '#layer%7B',%0A      '  marker-fill: #7c1d6f;',%0A      '%7D'%0A    %5D.join('%5Cn');%0A    var datasource = new DummyDatasource(function () %7B%0A      return %7B%0A        ramp: %5B1%5D,%0A        stats: %7B min_val: 1, max_val: 1, avg_val: 1 %7D%0A      %7D;%0A    %7D);%0A    turbocarto(turboCartocss, datasource, function (err, result
 ) %7B%0A

Add test for less_than strategy