Skip to content

Commit

Permalink
Additional tests and remove unnecessary definition
Browse files Browse the repository at this point in the history
  • Loading branch information
mgriffin-scottlogic committed Mar 28, 2024
1 parent bdca96f commit 88fb49f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
1 change: 0 additions & 1 deletion examples/ramboll-resilio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ initialize:
object-storage:
method: RambollResilio
path: "if-carbon-hack-plugin"
global-config: {}
tree:
pipeline:
- import-data
Expand Down
34 changes: 33 additions & 1 deletion src/__tests__/unit/lib/storage-energy.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {SECONDS_IN_YEAR} from '../../../lib/constants';
import {SECONDS_IN_HOUR, SECONDS_IN_YEAR} from '../../../lib/constants';
import {StorageEnergy} from '../../../lib/storage-energy';

describe('lib/storage-energy: ', () => {
Expand All @@ -13,6 +13,38 @@ describe('lib/storage-energy: ', () => {
});

describe('execute(): ', () => {
it('calculates kWh of storing 1Tb for one hour using CCF HDD figures.', async () => {
const pluginInstance = StorageEnergy();
const inputs = [
{
duration: SECONDS_IN_HOUR,
'storage/drive-size': 10000,
'storage/drive-power': 6.5,
'storage/data-stored': 1000,
},
];

const response = await pluginInstance.execute(inputs, {});
expect(response[0]).toHaveProperty('storage/energy');
expect(response[0]['storage/energy']).toBeCloseTo(0.00065);
});

it('calculates kWh of storing 1Tb for one hour using CCF SSD figures.', async () => {
const pluginInstance = StorageEnergy();
const inputs = [
{
duration: SECONDS_IN_HOUR,
'storage/drive-size': 5000,
'storage/drive-power': 6,
'storage/data-stored': 1000,
},
];

const response = await pluginInstance.execute(inputs, {});
expect(response[0]).toHaveProperty('storage/energy');
expect(response[0]['storage/energy']).toBeCloseTo(0.0012);
});

it('calculates kWh of storing 1Gb for one year.', async () => {
const pluginInstance = StorageEnergy();
const inputs = [
Expand Down

0 comments on commit 88fb49f

Please sign in to comment.