@@ -211,226 +211,244 @@ describe("if there are emissions", () => {
211211 expect ( selectors . getCurrentMonthAllCarbonValue ( state ) ) . toEqual (
212212 moment ( ) . month ( ) == 0
213213 ? Math . round (
214- calculation . getC02ValueFromEmission ( emissionFood ) +
215- calculation . getC02ValueFromEmission ( emissionFoodYear )
216- ) +
217- Math . round (
218- calculation . getC02ValueFromEmission ( emissionMeal ) +
219- calculation . getC02ValueFromEmission ( emissionMealYear )
220- ) +
221- Math . round (
222- calculation . getC02ValueFromEmission ( emissionTransport ) +
223- calculation . getC02ValueFromEmission ( emissionTransportYear )
224- ) +
225- Math . round (
226- calculation . getC02ValueFromEmission ( emissionStreaming ) +
227- calculation . getC02ValueFromEmission ( emissionStreamingYear )
228- ) +
229- Math . round (
230- calculation . getC02ValueFromEmission ( emissionPurchase ) +
231- calculation . getC02ValueFromEmission ( emissionPurchaseYear )
232- ) +
233- Math . round (
234- calculation . getC02ValueFromEmission ( emissionFashion ) +
235- calculation . getC02ValueFromEmission ( emissionFashionYear )
236- ) +
237- Math . round (
238- calculation . getC02ValueFromEmission ( emissionElectricity ) +
239- calculation . getC02ValueFromEmission ( emissionElectricityYear )
240- ) +
241- Math . round (
242- calculation . getC02ValueFromEmission ( emissionProductScanned ) +
243- calculation . getC02ValueFromEmission ( emissionProductScannedYear )
244- ) +
245- Math . round (
246- calculation . getC02ValueFromEmission ( emissionCustom ) +
247- calculation . getC02ValueFromEmission ( emissionCustomYear )
248- )
214+ calculation . getC02ValueFromEmission ( emissionFood ) +
215+ calculation . getC02ValueFromEmission ( emissionFoodYear )
216+ ) +
217+ Math . round (
218+ calculation . getC02ValueFromEmission ( emissionMeal ) +
219+ calculation . getC02ValueFromEmission ( emissionMealYear )
220+ ) +
221+ Math . round (
222+ calculation . getC02ValueFromEmission ( emissionTransport ) +
223+ calculation . getC02ValueFromEmission ( emissionTransportYear )
224+ ) +
225+ Math . round (
226+ calculation . getC02ValueFromEmission ( emissionStreaming ) +
227+ calculation . getC02ValueFromEmission ( emissionStreamingYear )
228+ ) +
229+ Math . round (
230+ calculation . getC02ValueFromEmission ( emissionPurchase ) +
231+ calculation . getC02ValueFromEmission ( emissionPurchaseYear )
232+ ) +
233+ Math . round (
234+ calculation . getC02ValueFromEmission ( emissionFashion ) +
235+ calculation . getC02ValueFromEmission ( emissionFashionYear )
236+ ) +
237+ Math . round (
238+ calculation . getC02ValueFromEmission ( emissionElectricity ) +
239+ calculation . getC02ValueFromEmission ( emissionElectricityYear )
240+ ) +
241+ Math . round (
242+ calculation . getC02ValueFromEmission ( emissionProductScanned ) +
243+ calculation . getC02ValueFromEmission ( emissionProductScannedYear )
244+ ) +
245+ Math . round (
246+ calculation . getC02ValueFromEmission ( emissionCustom ) +
247+ calculation . getC02ValueFromEmission ( emissionCustomYear )
248+ )
249249 : Math . round ( calculation . getC02ValueFromEmission ( emissionFood ) ) +
250- Math . round ( calculation . getC02ValueFromEmission ( emissionMeal ) ) +
251- Math . round ( calculation . getC02ValueFromEmission ( emissionTransport ) ) +
252- Math . round ( calculation . getC02ValueFromEmission ( emissionStreaming ) ) +
253- Math . round ( calculation . getC02ValueFromEmission ( emissionPurchase ) ) +
254- Math . round ( calculation . getC02ValueFromEmission ( emissionFashion ) ) +
255- Math . round ( calculation . getC02ValueFromEmission ( emissionElectricity ) ) +
256- Math . round ( calculation . getC02ValueFromEmission ( emissionProductScanned ) ) +
257- Math . round ( calculation . getC02ValueFromEmission ( emissionCustom ) )
250+ Math . round ( calculation . getC02ValueFromEmission ( emissionMeal ) ) +
251+ Math . round ( calculation . getC02ValueFromEmission ( emissionTransport ) ) +
252+ Math . round ( calculation . getC02ValueFromEmission ( emissionStreaming ) ) +
253+ Math . round ( calculation . getC02ValueFromEmission ( emissionPurchase ) ) +
254+ Math . round ( calculation . getC02ValueFromEmission ( emissionFashion ) ) +
255+ Math . round ( calculation . getC02ValueFromEmission ( emissionElectricity ) ) +
256+ Math . round ( calculation . getC02ValueFromEmission ( emissionProductScanned ) ) +
257+ Math . round ( calculation . getC02ValueFromEmission ( emissionCustom ) )
258258 ) ) ;
259259
260260 test ( "`getCurrentMonthFoodCarbonValue` should return CO2 value from today's emission" , ( ) =>
261261 expect ( selectors . getCurrentMonthFoodCarbonValue ( state ) ) . toEqual (
262262 moment ( ) . month ( ) == 0
263263 ? Math . round (
264- calculation . getC02ValueFromEmission ( emissionFood ) +
265- calculation . getC02ValueFromEmission ( emissionFoodYear )
266- )
264+ calculation . getC02ValueFromEmission ( emissionFood ) +
265+ calculation . getC02ValueFromEmission ( emissionFoodYear )
266+ )
267267 : Math . round ( calculation . getC02ValueFromEmission ( emissionFood ) )
268268 ) ) ;
269269
270270 test ( "`getCurrentMonthMealCarbonValue` should return CO2 value from today's emission" , ( ) =>
271271 expect ( selectors . getCurrentMonthMealCarbonValue ( state ) ) . toEqual (
272272 moment ( ) . month ( ) == 0
273273 ? Math . round (
274- calculation . getC02ValueFromEmission ( emissionMeal ) +
275- calculation . getC02ValueFromEmission ( emissionMealYear )
276- )
274+ calculation . getC02ValueFromEmission ( emissionMeal ) +
275+ calculation . getC02ValueFromEmission ( emissionMealYear )
276+ )
277277 : Math . round ( calculation . getC02ValueFromEmission ( emissionMeal ) )
278278 ) ) ;
279279
280280 test ( "`getCurrentMonthTransportCarbonValue` should return CO2 values from today's emission" , ( ) =>
281281 expect ( selectors . getCurrentMonthTransportCarbonValue ( state ) ) . toEqual (
282282 moment ( ) . month ( ) == 0
283283 ? Math . round (
284- calculation . getC02ValueFromEmission ( emissionTransport ) +
285- calculation . getC02ValueFromEmission ( emissionTransportYear )
286- )
284+ calculation . getC02ValueFromEmission ( emissionTransport ) +
285+ calculation . getC02ValueFromEmission ( emissionTransportYear )
286+ )
287287 : Math . round ( calculation . getC02ValueFromEmission ( emissionTransport ) )
288288 ) ) ;
289289
290290 test ( "`getCurrentMonthStreamingCarbonValue` should return CO2 value from today's emission" , ( ) =>
291291 expect ( selectors . getCurrentMonthStreamingCarbonValue ( state ) ) . toEqual (
292292 moment ( ) . month ( ) == 0
293293 ? Math . round (
294- calculation . getC02ValueFromEmission ( emissionStreaming ) +
295- calculation . getC02ValueFromEmission ( emissionStreamingYear )
296- )
294+ calculation . getC02ValueFromEmission ( emissionStreaming ) +
295+ calculation . getC02ValueFromEmission ( emissionStreamingYear )
296+ )
297297 : Math . round ( calculation . getC02ValueFromEmission ( emissionStreaming ) )
298298 ) ) ;
299299
300300 test ( "`getCurrentMonthPurchaseCarbonValue` should return CO2 value from today's emission" , ( ) =>
301301 expect ( selectors . getCurrentMonthPurchaseCarbonValue ( state ) ) . toEqual (
302302 moment ( ) . month ( ) == 0
303303 ? calculation . getC02ValueFromEmission ( emissionPurchase ) +
304- calculation . getC02ValueFromEmission ( emissionPurchaseYear )
304+ calculation . getC02ValueFromEmission ( emissionPurchaseYear )
305305 : calculation . getC02ValueFromEmission ( emissionPurchase )
306306 ) ) ;
307307
308308 test ( "`getCurrentMonthFashionCarbonValue` should return CO2 value from today's emission" , ( ) =>
309309 expect ( selectors . getCurrentMonthFashionCarbonValue ( state ) ) . toEqual (
310310 moment ( ) . month ( ) == 0
311311 ? calculation . getC02ValueFromEmission ( emissionFashion ) +
312- calculation . getC02ValueFromEmission ( emissionFashionYear )
312+ calculation . getC02ValueFromEmission ( emissionFashionYear )
313313 : calculation . getC02ValueFromEmission ( emissionFashion )
314314 ) ) ;
315315
316316 test ( "`getCurrentMonthElectricityCarbonValue` should return CO2 value from today's emission" , ( ) =>
317317 expect ( selectors . getCurrentMonthElectricityCarbonValue ( state ) ) . toEqual (
318318 moment ( ) . month ( ) == 0
319319 ? Math . round (
320- calculation . getC02ValueFromEmission ( emissionElectricity ) +
321- calculation . getC02ValueFromEmission ( emissionElectricityYear )
322- )
320+ calculation . getC02ValueFromEmission ( emissionElectricity ) +
321+ calculation . getC02ValueFromEmission ( emissionElectricityYear )
322+ )
323323 : Math . round ( calculation . getC02ValueFromEmission ( emissionElectricity ) )
324324 ) ) ;
325325
326326 test ( "`getCurrentMonthProductScannedCarbonValue` should return CO2 value from today's emission" , ( ) =>
327327 expect ( selectors . getCurrentMonthProductScannedCarbonValue ( state ) ) . toEqual (
328328 moment ( ) . month ( ) == 0
329329 ? calculation . getC02ValueFromEmission ( emissionProductScanned ) +
330- calculation . getC02ValueFromEmission ( emissionProductScannedYear )
330+ calculation . getC02ValueFromEmission ( emissionProductScannedYear )
331331 : calculation . getC02ValueFromEmission ( emissionProductScanned )
332332 ) ) ;
333333
334334 test ( "`getCurrentMonthCustomCarbonValue` should return CO2 value from today's emission" , ( ) =>
335335 expect ( selectors . getCurrentMonthCustomCarbonValue ( state ) ) . toEqual (
336336 moment ( ) . month ( ) == 0
337337 ? calculation . getC02ValueFromEmission ( emissionCustom ) +
338- calculation . getC02ValueFromEmission ( emissionCustomYear )
338+ calculation . getC02ValueFromEmission ( emissionCustomYear )
339339 : calculation . getC02ValueFromEmission ( emissionCustom )
340340 ) ) ;
341341
342342 // last year
343343
344344 test ( "`getCurrentYearAllCarbonValue` should return CO2 value from today's emission" , ( ) =>
345345 expect ( selectors . getCurrentYearAllCarbonValue ( state ) ) . toEqual (
346- Math . round ( calculation . getC02ValueFromEmission ( emissionFood ) ) +
347- Math . round ( calculation . getC02ValueFromEmission ( emissionMeal ) ) +
348- Math . round ( calculation . getC02ValueFromEmission ( emissionTransport ) ) +
349- Math . round ( calculation . getC02ValueFromEmission ( emissionStreaming ) ) +
350- Math . round ( calculation . getC02ValueFromEmission ( emissionPurchase ) ) +
351- Math . round ( calculation . getC02ValueFromEmission ( emissionFashion ) ) +
352- Math . round ( calculation . getC02ValueFromEmission ( emissionElectricity ) ) +
353- Math . round ( calculation . getC02ValueFromEmission ( emissionProductScanned ) ) +
354- Math . round ( calculation . getC02ValueFromEmission ( emissionCustom ) ) +
355- Math . round ( calculation . getC02ValueFromEmission ( emissionFoodYear ) ) +
356- Math . round ( calculation . getC02ValueFromEmission ( emissionMealYear ) ) +
357- Math . round ( calculation . getC02ValueFromEmission ( emissionTransportYear ) ) +
358- Math . round ( calculation . getC02ValueFromEmission ( emissionStreamingYear ) ) +
359- Math . round ( calculation . getC02ValueFromEmission ( emissionPurchaseYear ) ) +
360- Math . round ( calculation . getC02ValueFromEmission ( emissionFashionYear ) ) +
361- Math . round ( calculation . getC02ValueFromEmission ( emissionElectricityYear ) ) +
362- Math . round ( calculation . getC02ValueFromEmission ( emissionProductScannedYear ) ) +
363- Math . round ( calculation . getC02ValueFromEmission ( emissionCustomYear ) )
346+ Math . round (
347+ calculation . getC02ValueFromEmission ( emissionFood ) +
348+ calculation . getC02ValueFromEmission ( emissionFoodYear )
349+ ) +
350+ Math . round (
351+ calculation . getC02ValueFromEmission ( emissionMeal ) +
352+ calculation . getC02ValueFromEmission ( emissionMealYear )
353+ ) +
354+ Math . round (
355+ calculation . getC02ValueFromEmission ( emissionTransport ) +
356+ calculation . getC02ValueFromEmission ( emissionTransportYear )
357+ ) +
358+ Math . round (
359+ calculation . getC02ValueFromEmission ( emissionStreaming ) +
360+ calculation . getC02ValueFromEmission ( emissionStreamingYear )
361+ ) +
362+ Math . round (
363+ calculation . getC02ValueFromEmission ( emissionPurchase ) +
364+ calculation . getC02ValueFromEmission ( emissionPurchaseYear )
365+ ) +
366+ Math . round (
367+ calculation . getC02ValueFromEmission ( emissionFashion ) +
368+ calculation . getC02ValueFromEmission ( emissionFashionYear )
369+ ) +
370+ Math . round (
371+ calculation . getC02ValueFromEmission ( emissionElectricity ) +
372+ calculation . getC02ValueFromEmission ( emissionElectricityYear )
373+ ) +
374+ Math . round (
375+ calculation . getC02ValueFromEmission ( emissionProductScanned ) +
376+ calculation . getC02ValueFromEmission ( emissionProductScannedYear )
377+ ) +
378+ Math . round (
379+ calculation . getC02ValueFromEmission ( emissionCustom ) +
380+ calculation . getC02ValueFromEmission ( emissionCustomYear )
381+ )
364382 ) ) ;
365383
366384 test ( "`getCurrentYearFoodCarbonValue` should return CO2 value from today's emission" , ( ) =>
367385 expect ( selectors . getCurrentYearFoodCarbonValue ( state ) ) . toEqual (
368386 Math . round (
369387 calculation . getC02ValueFromEmission ( emissionFood ) +
370- calculation . getC02ValueFromEmission ( emissionFoodYear )
388+ calculation . getC02ValueFromEmission ( emissionFoodYear )
371389 )
372390 ) ) ;
373391
374392 test ( "`getCurrentYearMealCarbonValue` should return CO2 value from today's emission" , ( ) =>
375393 expect ( selectors . getCurrentYearMealCarbonValue ( state ) ) . toEqual (
376394 Math . round (
377395 calculation . getC02ValueFromEmission ( emissionMeal ) +
378- calculation . getC02ValueFromEmission ( emissionMealYear )
396+ calculation . getC02ValueFromEmission ( emissionMealYear )
379397 )
380398 ) ) ;
381399
382400 test ( "`getCurrentYearTransportCarbonValue` should return CO2 values from today's emission" , ( ) =>
383401 expect ( selectors . getCurrentYearTransportCarbonValue ( state ) ) . toEqual (
384402 Math . round (
385403 calculation . getC02ValueFromEmission ( emissionTransport ) +
386- calculation . getC02ValueFromEmission ( emissionTransportYear )
404+ calculation . getC02ValueFromEmission ( emissionTransportYear )
387405 )
388406 ) ) ;
389407
390408 test ( "`getCurrentYearStreamingCarbonValue` should return CO2 value from today's emission" , ( ) =>
391409 expect ( selectors . getCurrentYearStreamingCarbonValue ( state ) ) . toEqual (
392410 Math . round (
393411 calculation . getC02ValueFromEmission ( emissionStreaming ) +
394- calculation . getC02ValueFromEmission ( emissionStreamingYear )
412+ calculation . getC02ValueFromEmission ( emissionStreamingYear )
395413 )
396414 ) ) ;
397415
398416 test ( "`getCurrentYearPurchaseCarbonValue` should return CO2 value from today's emission" , ( ) =>
399417 expect ( selectors . getCurrentYearPurchaseCarbonValue ( state ) ) . toEqual (
400418 Math . round (
401419 calculation . getC02ValueFromEmission ( emissionPurchase ) +
402- calculation . getC02ValueFromEmission ( emissionPurchaseYear )
420+ calculation . getC02ValueFromEmission ( emissionPurchaseYear )
403421 )
404422 ) ) ;
405423
406424 test ( "`getCurrentYearFashionCarbonValue` should return CO2 value from today's emission" , ( ) =>
407425 expect ( selectors . getCurrentYearFashionCarbonValue ( state ) ) . toEqual (
408426 Math . round (
409427 calculation . getC02ValueFromEmission ( emissionFashion ) +
410- calculation . getC02ValueFromEmission ( emissionFashionYear )
428+ calculation . getC02ValueFromEmission ( emissionFashionYear )
411429 )
412430 ) ) ;
413431
414432 test ( "`getCurrentYearElectricityCarbonValue` should return CO2 value from today's emission" , ( ) =>
415433 expect ( selectors . getCurrentYearElectricityCarbonValue ( state ) ) . toEqual (
416434 Math . round (
417435 calculation . getC02ValueFromEmission ( emissionElectricity ) +
418- calculation . getC02ValueFromEmission ( emissionElectricityYear )
436+ calculation . getC02ValueFromEmission ( emissionElectricityYear )
419437 )
420438 ) ) ;
421439
422440 test ( "`getCurrentYearProductScannedCarbonValue` should return CO2 value from today's emission" , ( ) =>
423441 expect ( selectors . getCurrentYearProductScannedCarbonValue ( state ) ) . toEqual (
424442 Math . round (
425443 calculation . getC02ValueFromEmission ( emissionProductScanned ) +
426- calculation . getC02ValueFromEmission ( emissionProductScannedYear )
444+ calculation . getC02ValueFromEmission ( emissionProductScannedYear )
427445 )
428446 ) ) ;
429447
430448 test ( "`getCurrentYearCustomCarbonValue` should return CO2 value from today's emission" , ( ) =>
431449 expect ( selectors . getCurrentYearCustomCarbonValue ( state ) ) . toEqual (
432450 calculation . getC02ValueFromEmission ( emissionCustom ) +
433- calculation . getC02ValueFromEmission ( emissionCustomYear )
451+ calculation . getC02ValueFromEmission ( emissionCustomYear )
434452 ) ) ;
435453} ) ;
436454
0 commit comments