Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(web): present electric net exchange chart for 30d+ views #7594

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading