Skip to content

Commit

Permalink
bug(web): present net exchange chart for 30d+ views (#7594)
Browse files Browse the repository at this point in the history
  • Loading branch information
consideRatio authored Dec 23, 2024
1 parent f055a0c commit 8d6ad84
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
16 changes: 0 additions & 16 deletions web/src/utils/helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,21 +360,8 @@ describe('useNavigateWithParameters', () => {
});

describe('getNetExchange', () => {
it('should return NaN when zoneData.exchange is empty', () => {
const zoneData = {
exchange: {},
totalImport: null,
totalExport: null,
totalCo2Import: null,
totalCo2Export: null,
} as ZoneDetail;
const result = getNetExchange(zoneData, false);
expect(result).toBeNaN();
});

it('should return NaN when displayByEmissions is false and both totalImport and totalExport are null', () => {
const zoneData = {
exchange: { someKey: 1 },
totalImport: null,
totalExport: null,
totalCo2Import: null,
Expand All @@ -386,7 +373,6 @@ describe('getNetExchange', () => {

it('should return NaN when displayByEmissions is true and both totalCo2Import and totalCo2Export are null', () => {
const zoneData = {
exchange: { someKey: 1 },
totalImport: null,
totalExport: null,
totalCo2Import: null,
Expand All @@ -398,7 +384,6 @@ describe('getNetExchange', () => {

it('should return the correct net exchange value when displayByEmissions is false and totalImport and totalExport have values', () => {
const zoneData = {
exchange: { someKey: 1 },
totalImport: 100,
totalExport: 50,
totalCo2Import: null,
Expand All @@ -410,7 +395,6 @@ describe('getNetExchange', () => {

it('should return the correct net exchange value when displayByEmissions is true and totalCo2Import and totalCo2Export have values', () => {
const zoneData = {
exchange: { someKey: 1 },
totalImport: null,
totalExport: null,
totalCo2Import: 200,
Expand Down
4 changes: 0 additions & 4 deletions web/src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,6 @@ export function getNetExchange(
zoneData: ZoneDetail,
displayByEmissions: boolean
): number {
if (Object.keys(zoneData.exchange).length === 0) {
return Number.NaN;
}

if (
!displayByEmissions &&
zoneData.totalImport === null &&
Expand Down

0 comments on commit 8d6ad84

Please sign in to comment.