~ubuntu-branches/ubuntu/utopic/node-millstone/utopic

« back to all changes in this revision

Viewing changes to test/uppercase-ext.test.js

  • Committer: Package Import Robot
  • Author(s): Jérémy Lal
  • Date: 2013-10-25 23:32:34 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20131025233234-v0iwqix6n787nn19
Tags: 0.6.8-1
* New upstream version
* Canonicalize Vcs fields
* Standards-Version 3.9.4
* Rewrite package long description
* Watch github
* Build-Depends nodejs, or else is uninstallable on some archs.
* Match upstream dependencies. Loosen versions, all packages are
  in testing now.
* Install usr/bin/millstone and a manpage for it
* Copyright:
  + remove debian/* paragraph, with permission
  + add paragraph for naturalearth files used in tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
var fs = require('fs');
 
2
var path = require('path');
 
3
var assert = require('assert');
 
4
 
 
5
// switch to 'development' for more verbose logging
 
6
process.env.NODE_ENV = 'production'
 
7
var utils = require('../lib/util.js');
 
8
var millstone = require('../lib/millstone');
 
9
var tests = module.exports = {};
 
10
var rm = require('./support.js').rm;
 
11
 
 
12
var existsSync = require('fs').existsSync || require('path').existsSync;
 
13
 
 
14
beforeEach(function(){
 
15
  rm(path.join(__dirname, '/tmp/millstone-test'));
 
16
})
 
17
 
 
18
it('correctly handles datasources with uppercase extensions', function(done) {
 
19
    var mml = JSON.parse(fs.readFileSync(path.join(__dirname, 'UPPERCASE_EXT/project.mml')));
 
20
    
 
21
    var cache = '/tmp/millstone-test';
 
22
    var options = {
 
23
        mml: mml,
 
24
        base: path.join(__dirname, 'UPPERCASE_EXT'),
 
25
        cache: cache
 
26
    };
 
27
 
 
28
    try {
 
29
        fs.mkdirSync(options.cache, 0777);
 
30
    } catch (e) {}
 
31
 
 
32
    millstone.resolve(options, function(err, resolved) {
 
33
        assert.equal(err,undefined,err);
 
34
        assert.equal(resolved.Stylesheet[0].id, 'style.mss');
 
35
        assert.equal(resolved.Stylesheet[0].data, '#polygon { }');
 
36
        var expected = [
 
37
            {
 
38
                "name": "uppercase-ext",
 
39
                "Datasource": {
 
40
                    "file": path.join(__dirname, 'UPPERCASE_EXT/test1.CSV'),
 
41
                    "type": "csv"
 
42
                },
 
43
                "srs": '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'
 
44
            }
 
45
        ];
 
46
        assert.deepEqual(resolved.Layer, expected);
 
47
        done();
 
48
    });
 
49
});