From 146d494cae7c58f20e12c8b3b7abdb3da32f5818 Mon Sep 17 00:00:00 2001 From: Raul Ochoa Date: Thu, 21 Apr 2016 15:35:45 +0200 Subject: [PATCH] Adds dataview example in named map --- test/acceptance/analysis/named-maps.js | 41 ++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/test/acceptance/analysis/named-maps.js b/test/acceptance/analysis/named-maps.js index 197c281f..e022999c 100644 --- a/test/acceptance/analysis/named-maps.js +++ b/test/acceptance/analysis/named-maps.js @@ -40,6 +40,17 @@ describe('named-maps analysis', function() { } } ], + dataviews: { + pop_max_histogram: { + source: { + id: 'HEAD' + }, + type: 'histogram', + options: { + column: 'pop_max' + } + } + }, analyses: [ { "id": "HEAD", @@ -185,4 +196,34 @@ describe('named-maps analysis', function() { ); }); + it('should be able to retrieve dataviews from analysis', function(done) { + assert.response( + server, + { + url: '/api/v1/map/' + layergroupid + '/dataview/pop_max_histogram', + method: 'GET', + headers: { + host: username + } + }, + { + status: 200, + headers: { + 'Content-Type': 'application/json; charset=utf-8' + } + }, + function(res, err) { + if (err) { + return done(err); + } + + var dataview = JSON.parse(res.body); + assert.equal(dataview.type, 'histogram'); + assert.equal(dataview.bins_start, 0); + + done(); + } + ); + }); + });