-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
29 lines (25 loc) · 973 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var expect = require('expect.js');
var server = require('..');
var client = require('../build/build');
var data = require('./test-data');
function test(simplify, name) {
describe(name + ' side', function () {
it('works with low quality', function () {
var expected = [{x:224.55,y:250.15,z:237.35},
{x:268.33,y:212.45,z:240.39},
{x:293.56,y:158.5,z:226.03}];
var actual = simplify(data, 5);
expect(JSON.stringify(actual)).to.equal(JSON.stringify(expected));
});
it('works with high quality', function () {
var expected = [{x:224.55,y:250.15,z:237.35},
{x:267.76,y:213.81,z:240.78},
{x:273.09,y:192.22,z:232.65},
{x:293.56,y:158.5,z:226.03}];
var actual = simplify(data, 5, true);
expect(JSON.stringify(actual)).to.equal(JSON.stringify(expected));
});
});
}
test(server, 'server');
test(client, 'client');