UNPKG

2.15 kBJavaScriptView Raw
1var convert = require('../lib')
2 , assert = require('assert')
3 , tests = {};
4
5tests['Wh to Wh'] = function () {
6 assert.strictEqual( convert(1).from('Wh').to('Wh') , 1);
7};
8
9tests['mWh to mWh'] = function () {
10 assert.strictEqual( convert(1).from('mWh').to('mWh') , 1);
11};
12
13tests['kWh to kWh'] = function () {
14 assert.strictEqual( convert(1).from('kWh').to('kWh') , 1);
15};
16
17tests['MWh to MWh'] = function () {
18 assert.strictEqual( convert(1).from('MWh').to('MWh') , 1);
19};
20
21tests['GWh to GWh'] = function () {
22 assert.strictEqual( convert(1).from('GWh').to('GWh') , 1);
23};
24
25tests['J to J'] = function () {
26 assert.strictEqual( convert(1).from('J').to('J') , 1);
27};
28
29tests['kJ to kJ'] = function () {
30 assert.strictEqual( convert(1).from('kJ').to('kJ') , 1);
31};
32
33tests['Wh to J'] = function () {
34 assert.strictEqual( convert(1).from('Wh').to('J') , 3600);
35};
36
37tests['Wh to mWh'] = function () {
38 assert.strictEqual( convert(1).from('Wh').to('mWh') , 1000);
39};
40
41tests['Wh to kWh'] = function () {
42 assert.strictEqual( convert(1).from('Wh').to('kWh') , 0.001);
43};
44
45tests['Wh to MWh'] = function () {
46 assert.strictEqual( convert(1).from('Wh').to('MWh') , 0.000001);
47};
48
49tests['Wh to GWh'] = function () {
50 assert.strictEqual( convert(1).from('Wh').to('GWh') , 0.000000001);
51};
52
53tests['GWh to mWh'] = function () {
54 assert.strictEqual( convert(1).from('GWh').to('mWh'), 1000000000000);
55}
56
57tests['GWh to J'] = function () {
58 assert.strictEqual( convert(1).from('GWh').to('J'), 3600000000000);
59}
60
61tests['MWh to mWh'] = function () {
62 assert.strictEqual( convert(1).from('MWh').to('mWh'), 1000000000);
63}
64
65tests['kWh to mWh'] = function () {
66 assert.strictEqual( convert(1).from('kWh').to('mWh'), 1000000);
67}
68
69tests['mWh to kWh'] = function () {
70 assert.strictEqual( convert(1).from('mWh').to('kWh'), 0.000001);
71}
72
73tests['mWh to Wh'] = function () {
74 assert.strictEqual( convert(1).from('mWh').to('Wh'), 0.001);
75}
76
77tests['kWh to Wh'] = function () {
78 assert.strictEqual( convert(1).from('kWh').to('Wh'), 1000);
79}
80
81tests['kWh to kJ'] = function () {
82 assert.strictEqual( convert(1).from('kWh').to('kJ'), 3600);
83}
84
85module.exports = tests;