From 0f2f91e83aaa59277987ca5a747e2c510e62f071 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Tue, 13 Apr 2021 20:57:38 +0100 Subject: [PATCH] Unit tests #118 --- server/test/device.test.js | 42 ++++++++++++++++++------------------- server/test/request.test.js | 4 ++-- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/server/test/device.test.js b/server/test/device.test.js index 396f02f0..363fd7ba 100644 --- a/server/test/device.test.js +++ b/server/test/device.test.js @@ -25,7 +25,7 @@ describe('Device', () => { assert.strictEqual(device.features['-x'].default, 103); assert.strictEqual(device.features['-y'].limits[0], 0); assert.strictEqual(device.features['-y'].limits[1], 297); - assert.strictEqual(device.features['-y'].default, 76); + assert.strictEqual(device.features['-y'].default, 76.2); assert.strictEqual(device.features['--brightness'].limits[0], -100); assert.strictEqual(device.features['--brightness'].limits[1], 100); assert.strictEqual(device.features['--brightness'].interval, 1); @@ -47,17 +47,17 @@ describe('Device', () => { assert.deepStrictEqual(device.features['--resolution'].options, [75, 300, 600, 1200]); assert.strictEqual(device.features['--resolution'].default, 75); assert.strictEqual(device.features['-l'].limits[0], 0); - assert.strictEqual(device.features['-l'].limits[1], 215); + assert.strictEqual(device.features['-l'].limits[1], 215.9); assert.strictEqual(device.features['-l'].default, 0); assert.strictEqual(device.features['-t'].limits[0], 0); - assert.strictEqual(device.features['-t'].limits[1], 297); + assert.strictEqual(device.features['-t'].limits[1], 297.1); assert.strictEqual(device.features['-t'].default, 0); assert.strictEqual(device.features['-x'].limits[0], 0); - assert.strictEqual(device.features['-x'].limits[1], 215); - assert.strictEqual(device.features['-x'].default, 215); + assert.strictEqual(device.features['-x'].limits[1], 215.9); + assert.strictEqual(device.features['-x'].default, 215.9); assert.strictEqual(device.features['-y'].limits[0], 0); - assert.strictEqual(device.features['-y'].limits[1], 297); - assert.strictEqual(device.features['-y'].default, 297); + assert.strictEqual(device.features['-y'].limits[1], 297.1); + assert.strictEqual(device.features['-y'].default, 297.1); assert.strictEqual(device.features['--brightness'], undefined); assert.strictEqual(device.features['--contrast'], undefined); }); @@ -73,13 +73,13 @@ describe('Device', () => { assert.deepStrictEqual(device.features['--resolution'].options, [75, 300, 600, 1200]); assert.strictEqual(device.features['--resolution'].default, 75); assert.strictEqual(device.features['-l'].limits[0], 0); - assert.strictEqual(device.features['-l'].limits[1], 215); + assert.strictEqual(device.features['-l'].limits[1], 215.9); assert.strictEqual(device.features['-t'].limits[0], 0); - assert.strictEqual(device.features['-t'].limits[1], 297); + assert.strictEqual(device.features['-t'].limits[1], 297.1); assert.strictEqual(device.features['-x'].limits[0], 0); - assert.strictEqual(device.features['-x'].limits[1], 215); + assert.strictEqual(device.features['-x'].limits[1], 215.9); assert.strictEqual(device.features['-y'].limits[0], 0); - assert.strictEqual(device.features['-y'].limits[1], 297); + assert.strictEqual(device.features['-y'].limits[1], 297.1); assert.strictEqual(device.features['--brightness'].limits[0], -50); assert.strictEqual(device.features['--brightness'].limits[1], 50); assert.strictEqual(device.features['--brightness'].interval, 1); @@ -102,13 +102,13 @@ describe('Device', () => { assert.deepStrictEqual(device.features['--resolution'].options, [75, 100, 150, 200, 300, 600, 1200]); assert.strictEqual(device.features['--resolution'].default, 150); assert.strictEqual(device.features['-l'].limits[0], 0); - assert.strictEqual(device.features['-l'].limits[1], 215); + assert.strictEqual(device.features['-l'].limits[1], 215.9); assert.strictEqual(device.features['-t'].limits[0], 0); - assert.strictEqual(device.features['-t'].limits[1], 297); + assert.strictEqual(device.features['-t'].limits[1], 297.1); assert.strictEqual(device.features['-x'].limits[0], 0); - assert.strictEqual(device.features['-x'].limits[1], 215); + assert.strictEqual(device.features['-x'].limits[1], 215.9); assert.strictEqual(device.features['-y'].limits[0], 0); - assert.strictEqual(device.features['-y'].limits[1], 297); + assert.strictEqual(device.features['-y'].limits[1], 297.1); assert.strictEqual(device.features['--brightness'], undefined); assert.strictEqual(device.features['--contrast'], undefined); }); @@ -127,11 +127,11 @@ describe('Device', () => { assert.strictEqual(device.features['-l'].limits[0], 0); assert.strictEqual(device.features['-l'].limits[1], 216); assert.strictEqual(device.features['-t'].limits[0], 0); - assert.strictEqual(device.features['-t'].limits[1], 355); + assert.strictEqual(device.features['-t'].limits[1], 355.6); assert.strictEqual(device.features['-x'].limits[0], 0); assert.strictEqual(device.features['-x'].limits[1], 216); assert.strictEqual(device.features['-y'].limits[0], 0); - assert.strictEqual(device.features['-y'].limits[1], 355); + assert.strictEqual(device.features['-y'].limits[1], 355.6); assert.strictEqual(device.features['--brightness'], undefined); assert.strictEqual(device.features['--contrast'], undefined); }); @@ -148,13 +148,13 @@ describe('Device', () => { assert.deepStrictEqual(device.features['--resolution'].options, [100, 150, 200, 300, 400, 600, 1200, 2400, 4800, 9600]); assert.strictEqual(device.features['--resolution'].default, 200); assert.strictEqual(device.features['-l'].limits[0], 0); - assert.strictEqual(device.features['-l'].limits[1], 215); + assert.strictEqual(device.features['-l'].limits[1], 215.9); assert.strictEqual(device.features['-t'].limits[0], 0); - assert.strictEqual(device.features['-t'].limits[1], 355); + assert.strictEqual(device.features['-t'].limits[1], 355.6); assert.strictEqual(device.features['-x'].limits[0], 0); - assert.strictEqual(device.features['-x'].limits[1], 215); + assert.strictEqual(device.features['-x'].limits[1], 215.9); assert.strictEqual(device.features['-y'].limits[0], 0); - assert.strictEqual(device.features['-y'].limits[1], 355); + assert.strictEqual(device.features['-y'].limits[1], 355.6); assert.strictEqual(device.features['--brightness'], undefined); assert.strictEqual(device.features['--contrast'], undefined); }); diff --git a/server/test/request.test.js b/server/test/request.test.js index d3f27265..1799ebcd 100644 --- a/server/test/request.test.js +++ b/server/test/request.test.js @@ -63,8 +63,8 @@ describe('Request', () => { assert.strictEqual(request.params.resolution, '150'); assert.strictEqual(request.params.left, 0); assert.strictEqual(request.params.top, 0); - assert.strictEqual(request.params.width, 215); - assert.strictEqual(request.params.height, 297); + assert.strictEqual(request.params.width, 215.9); + assert.strictEqual(request.params.height, 297.1); assert.strictEqual(request.params.brightness, undefined); assert.strictEqual(request.params.contrast, undefined); assert.strictEqual(request.params.dynamicLineart, undefined);