From fd55085a4bfd5ede4d495f65871806fc1e3c2d48 Mon Sep 17 00:00:00 2001 From: drydenwilliams Date: Wed, 9 Mar 2022 18:16:15 +0000 Subject: [PATCH] refactor: updating GLOBAL_INTENSITY figure from 475 => 440 --- src/sustainable-web-design.js | 4 ++-- src/sustainable-web-design.test.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sustainable-web-design.js b/src/sustainable-web-design.js index 235f07b..4e09b68 100644 --- a/src/sustainable-web-design.js +++ b/src/sustainable-web-design.js @@ -13,8 +13,8 @@ const { formatNumber } = require('./helpers'); // Taken from: https://sustainablewebdesign.org/calculating-digital-emissions/#:~:text=TWh/EB%20or-,0.81%20kWH/GB,-Carbon%20factor%20(global const KWH_PER_GB = 0.81; -// Taken from: https://sustainablewebdesign.org/calculating-digital-emissions/#:~:text=intensity%20of%20electricity%20(-,475g/kWh,-).%C2%A0 -const GLOBAL_INTENSITY = 475; +// Taken from: https://www.iea.org/reports/renewables-2021 +const GLOBAL_INTENSITY = 440; // Taken from: https://gitlab.com/wholegrain/carbon-api-2-0/-/blob/master/includes/carbonapi.php const FIRST_TIME_VIEWING_PERCENTAGE = 0.25; const RETURNING_VISITOR_PERCENTAGE = 0.75; diff --git a/src/sustainable-web-design.test.js b/src/sustainable-web-design.test.js index 1bcea41..091668d 100644 --- a/src/sustainable-web-design.test.js +++ b/src/sustainable-web-design.test.js @@ -20,7 +20,7 @@ describe('sustainable web design model', () => { it('should calculate the correct co2 per visit', () => { const averageWebsiteInBytes = 2257715.2; const energy = swd.energyPerVisit(averageWebsiteInBytes); - expect(swd.emissionsPerVisitInGrams(energy)).toEqual(0.21); + expect(swd.emissionsPerVisitInGrams(energy)).toEqual(0.2); }); it('should accept a dynamic KwH value', () => {