message: Add graveyard.test.js test in Jest from by
diff: -const { log } = require('console');
  const data = require('./graveyard.json');
  -// For every product
  +
  +describe('graveyard', () => {
  + it('graveyard', () => {
  data.forEach((product) => {
  - // Ensure that the duration between the close date and open date is not a negative number
  - try {
  - if ((new Date(product.dateClose) - new Date(product.dateOpen)) < 0) {
  - // If it's a negative number, error out
  - throw (new Error('Product dates are incorrect.'));
  - }
  - } catch (err) {
  - // Log the product so we know where to look.
  - log(product);
  - // Throw the error to Node.
  - throw err;
  - }
  + // All data is present for each product
  + expect(product.dateClose).not.toBeNull();
  + expect(product.dateOpen).not.toBeNull();
  + expect(product.description).not.toBeNull();
  + expect(product.link).not.toBeNull();
  + expect(product.name).not.toBeNull();
  +
  + // Dates are Chronologically Correct
  + const dateClose = new Date(product.dateClose).getTime();
  + const dateOpen = new Date(product.dateOpen).getTime();
  + expect(dateOpen).toBeLessThanOrEqual(dateClose);
  + });
  + });
  });
  