From d33b6b7f0b3c43ff8bcd99e3627967587f2e4f03 Mon Sep 17 00:00:00 2001 From: Nick DeJesus Date: Wed, 29 Nov 2023 19:46:31 -0500 Subject: [PATCH] Add timestamp (#336) * add timestamp to entry * add timestamps to mock data --- use-shopping-cart/core/Entry.js | 1 + use-shopping-cart/core/slice.test.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/use-shopping-cart/core/Entry.js b/use-shopping-cart/core/Entry.js index cde06ad4..047ff9b3 100644 --- a/use-shopping-cart/core/Entry.js +++ b/use-shopping-cart/core/Entry.js @@ -55,6 +55,7 @@ function Entry({ id, product, quantity, price_metadata, product_metadata }) { id, quantity, value: product.price * quantity, + timestamp: new Date().toISOString(), // add a timestamp in ISO 8601 format price_data: { ...product.price_data, ...price_metadata diff --git a/use-shopping-cart/core/slice.test.js b/use-shopping-cart/core/slice.test.js index 02fab9f2..8065f130 100644 --- a/use-shopping-cart/core/slice.test.js +++ b/use-shopping-cart/core/slice.test.js @@ -27,6 +27,7 @@ function mockCartDetails(overrides1, overrides2) { formattedValue: '$8.00', price_data: {}, product_data: {}, + timestamp: new Date().toISOString(), ...overrides1 }, [`id_efg${counter}`]: { @@ -41,6 +42,7 @@ function mockCartDetails(overrides1, overrides2) { formattedValue: '$10.00', price_data: {}, product_data: {}, + timestamp: new Date().toISOString(), ...overrides2 } }