From e7cf17b9fbe77d63fce76b67bceedf5cbd93c992 Mon Sep 17 00:00:00 2001 From: fershad <27988517+fershad@users.noreply.github.com> Date: Wed, 12 Jun 2024 21:29:34 +1000 Subject: [PATCH] check that SWD v3 returns the expected properties --- src/co2.test.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/co2.test.js b/src/co2.test.js index e570826..5ea635a 100644 --- a/src/co2.test.js +++ b/src/co2.test.js @@ -267,6 +267,33 @@ describe("co2", () => { co2.perVisit(MILLION, true) ); }); + + it("returns the expected properties", () => { + expect(co2.perByteTrace(MILLION)).toHaveProperty("co2"); + expect(co2.perByteTrace(MILLION)).toHaveProperty("variables"); + expect(co2.perByteTrace(MILLION)).toHaveProperty("green"); + expect(co2.perByteTrace(MILLION)).toHaveProperty( + "variables.gridIntensity" + ); + expect(co2.perByteTrace(MILLION)).not.toHaveProperty( + "variables.firstVisitPercentage" + ); + expect(co2.perVisitTrace(MILLION)).toHaveProperty("co2"); + expect(co2.perVisitTrace(MILLION)).toHaveProperty("variables"); + expect(co2.perVisitTrace(MILLION)).toHaveProperty("green"); + expect(co2.perVisitTrace(MILLION)).toHaveProperty( + "variables.gridIntensity" + ); + expect(co2.perVisitTrace(MILLION)).toHaveProperty( + "variables.firstVisitPercentage" + ); + expect(co2.perVisitTrace(MILLION)).toHaveProperty( + "variables.returnVisitPercentage" + ); + expect(co2.perVisitTrace(MILLION)).toHaveProperty( + "variables.dataReloadRatio" + ); + }); }); describe("Using custom grid intensity", () => {