File: filter.test.js

package info (click to toggle)
node-carto 0.9.5-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd, sid
  • size: 2,272 kB
  • ctags: 329
  • sloc: xml: 189; makefile: 22
file content (24 lines) | stat: -rw-r--r-- 861 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var assert = require('assert');
var tree = require('../lib/carto/tree.js');
require('../lib/carto/tree/field');
require('../lib/carto/tree/dimension');
require('../lib/carto/tree/filter');

describe('Field', function() {
    describe('basic functionality', function() {
        it('should be constructed', function() {
            var f = new tree.Filter(new tree.Field('foo'), '=', new tree.Dimension(1));
            assert.ok(f);
        });
        it('can be evaluated', function() {
            var f = new tree.Filter(new tree.Field('foo'), '=', new tree.Dimension(1));
            f.ev({});
            assert.ok(f);
        });
        it('yields xml', function() {
            var f = new tree.Filter(new tree.Field('foo'), '=', new tree.Dimension(1));
            f.ev({});
            assert.equal(f.toXML({}), '[foo] = 1');
        });
    });
});