|
1 |
| -import assert from 'assert'; |
2 |
| -import {round} from './utils'; |
3 |
| - |
4 |
| -import {heightToValue, valueToHeight} from '../elements/ngm-cam-configuration'; |
5 |
| - |
6 |
| -describe('ngm-cam-configuration', () => { |
7 |
| - describe('heightToValue', () => { |
8 |
| - it('should return value from height', () => { |
9 |
| - assert.equal(round(heightToValue(300000)), 1); |
10 |
| - assert.equal(round(heightToValue(150000)), 0.75); |
11 |
| - assert.equal(round(heightToValue(0)), 0.5); |
12 |
| - assert.equal(round(heightToValue(-18000)), 0.2); |
13 |
| - assert.equal(round(heightToValue(-30000)), 0); |
14 |
| - }); |
15 |
| - }); |
16 |
| - |
17 |
| - describe('valueToHeight', () => { |
18 |
| - it('should return height from value', () => { |
19 |
| - assert.equal(round(valueToHeight(1)), 300000); |
20 |
| - assert.equal(round(valueToHeight(0.75)), 150000); |
21 |
| - assert.equal(round(valueToHeight(0.5)), 0); |
22 |
| - assert.equal(round(valueToHeight(0.2)), -18000); |
23 |
| - assert.equal(round(valueToHeight(0)), -30000); |
24 |
| - }); |
25 |
| - }); |
26 |
| -}); |
| 1 | +import assert from 'assert'; |
| 2 | +import {round} from './utils'; |
| 3 | + |
| 4 | +import { |
| 5 | + ABSOLUTE_ELEVATION_MAX, |
| 6 | + ABSOLUTE_ELEVATION_MIN, |
| 7 | + heightToValue, |
| 8 | + valueToHeight |
| 9 | +} from '../elements/ngm-cam-configuration'; |
| 10 | + |
| 11 | +describe('ngm-cam-configuration', () => { |
| 12 | + describe('heightToValue', () => { |
| 13 | + it('should return value from height', () => { |
| 14 | + assert.equal(round(heightToValue(ABSOLUTE_ELEVATION_MAX)), 1); |
| 15 | + assert.equal(round(heightToValue(ABSOLUTE_ELEVATION_MAX / 2)), 0.75); |
| 16 | + assert.equal(round(heightToValue(0)), 0.5); |
| 17 | + assert.equal(round(heightToValue(-ABSOLUTE_ELEVATION_MIN * 0.6)), 0.2); |
| 18 | + assert.equal(round(heightToValue(-ABSOLUTE_ELEVATION_MIN)), 0); |
| 19 | + }); |
| 20 | + }); |
| 21 | + |
| 22 | + describe('valueToHeight', () => { |
| 23 | + it('should return height from value', () => { |
| 24 | + assert.equal(round(valueToHeight(1)), ABSOLUTE_ELEVATION_MAX); |
| 25 | + assert.equal(round(valueToHeight(0.75)), ABSOLUTE_ELEVATION_MAX / 2); |
| 26 | + assert.equal(round(valueToHeight(0.5)), 0); |
| 27 | + assert.equal(round(valueToHeight(0.2)), -ABSOLUTE_ELEVATION_MIN * 0.6); |
| 28 | + assert.equal(round(valueToHeight(0)), -ABSOLUTE_ELEVATION_MIN); |
| 29 | + }); |
| 30 | + }); |
| 31 | +}); |
0 commit comments