Debian Codegraph @

topojson/test/transform-properties-test.js

raw
1 var tape = require("tape"),
2 transformProperties = require("../lib/topojson/transform-properties");
3
4 tape("transform-properties by default, deletes properties from Features", function(test) {
5 test.deepEqual(transformProperties({
6 foo: {
7 type: "Feature",
8 properties: {"foo": 42},
9 geometry: {
10 type: "LineString",
11 coordinates: [0]
12 }
13 }
14 }).foo, {
15 type: "Feature",
16 geometry: {
17 type: "LineString",
18 coordinates: [0]
19 }
20 });
21 test.end();
22 });
23
24 tape("transform-properties observes the specified property transform function", function(test) {
25 test.deepEqual(transformProperties({
26 foo: {
27 type: "Feature",
28 properties: {"foo": 42},
29 geometry: {
30 type: "LineString",
31 coordinates: [0]
32 }
33 }
34 }, function(object) {
35 return {
36 bar: object.properties.foo
37 };
38 }).foo, {
39 type: "Feature",
40 properties: {"bar": 42},
41 geometry: {
42 type: "LineString",
43 coordinates: [0]
44 }
45 });
46 test.end();
47 });