mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-24 00:54:03 +02:00
Fixup tests
This commit is contained in:
@@ -2,11 +2,10 @@ describe('GeoJSON', function() {
|
||||
|
||||
describe('#mapping', function() {
|
||||
it('should be able to map a node to geojson', function() {
|
||||
var node = new iD.Node(10, 38, -77);
|
||||
expect(iD.GeoJSON.mapping(node).geometry.type).toEqual('Point');
|
||||
expect(iD.GeoJSON.mapping({ type: 'node', lat: 38, lon: -77 }).geometry.type).toEqual('Point');
|
||||
});
|
||||
it('should be able to map a way to geojson', function() {
|
||||
var way = new iD.Way();
|
||||
var way = { type: 'way', nodes: [] };
|
||||
var gj = iD.GeoJSON.mapping(way);
|
||||
expect(gj.type).toEqual('Feature');
|
||||
expect(gj.geometry.type).toEqual('LineString');
|
||||
|
||||
+1
-4
@@ -4,10 +4,7 @@ describe('Map', function() {
|
||||
beforeEach(function() {
|
||||
foo = document.body.appendChild(document.createElement('div'));
|
||||
foo.id = 'foo';
|
||||
map = iD.Map({
|
||||
selector: '#foo',
|
||||
connection: iD.Connection()
|
||||
});
|
||||
map = iD.Map(d3.select('#foo').node());
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
describe('Node', function() {
|
||||
var node;
|
||||
|
||||
beforeEach(function() {
|
||||
node = new iD.Node(10, 38, -77);
|
||||
});
|
||||
|
||||
it('is a node entity', function() {
|
||||
expect(node.type).toEqual('node');
|
||||
});
|
||||
|
||||
it('should be initialized with a proper ID, lat, and lon', function() {
|
||||
expect(node.id).toEqual(10);
|
||||
expect(node.lat).toEqual(38);
|
||||
expect(node.lon).toEqual(-77);
|
||||
});
|
||||
|
||||
it('knows if it is within a bounding box', function() {
|
||||
expect(node.intersects([[-90, 90], [90, -90]])).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,11 +0,0 @@
|
||||
describe('Relation', function() {
|
||||
var rm;
|
||||
|
||||
beforeEach(function() {
|
||||
rm = new iD.Relation();
|
||||
});
|
||||
|
||||
it('is instantiated', function() {
|
||||
expect(rm).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+3
-19
@@ -2,29 +2,13 @@ describe('Way', function() {
|
||||
var way;
|
||||
|
||||
beforeEach(function() {
|
||||
way = new iD.Way();
|
||||
console.log(way);
|
||||
way = { type: 'way', nodes: ['n1', 'n2'] };
|
||||
});
|
||||
|
||||
it('is a way', function() {
|
||||
expect(way.type).toEqual('way');
|
||||
});
|
||||
|
||||
it('has zero nodes by default', function() {
|
||||
expect(way.children.length).toEqual(0);
|
||||
});
|
||||
|
||||
describe('#isClosed', function() {
|
||||
it('is closed by default', function() {
|
||||
expect(way.isClosed()).toEqual(true);
|
||||
it('is not closed with two distinct nodes ', function() {
|
||||
expect(iD.Way.isClosed(way)).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
it('is a way when it has no nodes', function() {
|
||||
expect(way.isType('way')).toEqual(true);
|
||||
});
|
||||
|
||||
it('is also an area when it has no nodes', function() {
|
||||
expect(way.isType('area')).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user