fix tests
This commit is contained in:
parent
4a22bd4866
commit
982b32acd6
3 changed files with 21 additions and 19 deletions
|
|
@ -11,8 +11,8 @@ var testTileJSONArray = function(url) {
|
||||||
supertest(app)
|
supertest(app)
|
||||||
.get(url)
|
.get(url)
|
||||||
.expect(function(res) {
|
.expect(function(res) {
|
||||||
res.body.should.be.Array();
|
expect(res.body).to.be.a('array');
|
||||||
res.body.length.should.be.greaterThan(0);
|
expect(res.body.length).to.be.greaterThan(0);
|
||||||
}).end(done);
|
}).end(done);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -31,7 +31,7 @@ var testTileJSON = function(url) {
|
||||||
supertest(app)
|
supertest(app)
|
||||||
.get(url)
|
.get(url)
|
||||||
.expect(function(res) {
|
.expect(function(res) {
|
||||||
res.body.tiles.length.should.be.greaterThan(0);
|
expect(res.body.tiles.length).to.be.greaterThan(0);
|
||||||
}).end(done);
|
}).end(done);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -62,11 +62,11 @@ describe('Metadata', function() {
|
||||||
supertest(app)
|
supertest(app)
|
||||||
.get('/styles.json')
|
.get('/styles.json')
|
||||||
.expect(function(res) {
|
.expect(function(res) {
|
||||||
res.body.should.be.Array();
|
expect(res.body).to.be.a('array');
|
||||||
res.body.length.should.be.greaterThan(0);
|
expect(res.body.length).to.be.greaterThan(0);
|
||||||
res.body[0].version.should.equal(8);
|
expect(res.body[0].version).to.be.equal(8);
|
||||||
res.body[0].id.should.be.String();
|
expect(res.body[0].id).to.be.a('string');
|
||||||
res.body[0].name.should.be.String();
|
expect(res.body[0].name).to.be.a('string');
|
||||||
}).end(done);
|
}).end(done);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,16 @@
|
||||||
process.env.NODE_ENV = 'test';
|
process.env.NODE_ENV = 'test';
|
||||||
|
|
||||||
global.should = require('should');
|
import { expect } from 'chai';
|
||||||
global.supertest = require('supertest');
|
import supertest from "supertest";
|
||||||
|
import { server } from '../src/server.js';
|
||||||
|
|
||||||
require = require('esm')(module);
|
global.expect = expect
|
||||||
|
global.supertest = supertest
|
||||||
|
|
||||||
before(function() {
|
before(function() {
|
||||||
console.log('global setup');
|
console.log('global setup');
|
||||||
process.chdir('test_data');
|
process.chdir('test_data');
|
||||||
var running = require('../src/server')({
|
var running = server({
|
||||||
configPath: 'config.json',
|
configPath: 'config.json',
|
||||||
port: 8888,
|
port: 8888,
|
||||||
publicUrl: '/test/'
|
publicUrl: '/test/'
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,13 @@ describe('Styles', function() {
|
||||||
supertest(app)
|
supertest(app)
|
||||||
.get('/styles/' + prefix + '/style.json')
|
.get('/styles/' + prefix + '/style.json')
|
||||||
.expect(function(res) {
|
.expect(function(res) {
|
||||||
res.body.version.should.equal(8);
|
expect(res.body.version).to.be.equal(8);
|
||||||
res.body.name.should.be.String();
|
expect(res.body.name).to.be.a('string');
|
||||||
res.body.sources.should.be.Object();
|
expect(res.body.sources).to.be.a('object');
|
||||||
res.body.glyphs.should.be.String();
|
expect(res.body.glyphs).to.be.a('string');
|
||||||
res.body.sprite.should.be.String();
|
expect(res.body.sprite).to.be.a('string');
|
||||||
res.body.sprite.should.equal('/test/styles/test-style/sprite');
|
expect(res.body.sprite).to.be.equal('/test/styles/test-style/sprite');
|
||||||
res.body.layers.should.be.Array();
|
expect(res.body.layers).to.be.a('array');
|
||||||
}).end(done);
|
}).end(done);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue