Build a Cargo Manifest Validator - Build a Cargo Manifest Validator Step 16

Tell us what’s happening:

Everything passes except for step 16 which doesn’t seem possible as many of the steps before it require step 16 to pass.

Your code so far

const example = {
  containerId: "time",
  destination: "Monterey, California, USA",
  weight: 6,
  unit: "lb",
  hazmat: false
};

function normalizeUnits(manifest) {
  const newManifest = {
    containerId: manifest.containerId,
    destination: manifest.destination,
    weight: manifest.unit == "kg" ? manifest.weight : manifest.weight * 0.45,
    unit: "kg",
    hazmat: manifest.hazmat
  }
  return newManifest;
}

function validateManifest(manifest) {
  const error = {};
  if (manifest.containerId === undefined) {
    error.containerId = "Missing";
  } else if (typeof manifest.containerId != "number" || manifest.containerId <= 0 || !Number.isInteger(manifest.containerId)) {
    error.containerId = "Invalid";
  }

  if (manifest.destination === undefined) {
    error.destination = "Missing";
  } else if (typeof manifest.destination != "string" || manifest.destination.trim() === "") {
    error.destination = "Invalid";
  }

  if (manifest.weight === undefined) {
    error.weight = "Missing";
  } else if (typeof manifest.weight != "number" || manifest.weight < 0 || Number.isNaN(manifest.weight)) {
    error.weight = "Invalid";
  }

  if (manifest.unit === undefined) {
    error.unit = "Missing";
  } else if (manifest.unit != "kg" && manifest.unit != "lb") {
    error.unit = "Invalid";
  }

  if (manifest.hazmat === undefined) {
    error.hazmat = "Missing";
  } else if (typeof manifest.hazmat != "boolean") {
    error.hazmat = "Invalid";
  }

  return error;
}

function processManifest(manifest) {
  if (Object.keys(validateManifest(manifest)).length === 0) {
    console.log(`Validation success: ${manifest.containerId}`);
    console.log(`Total weight: ${normalizeUnits(manifest).weight} kg`);
  } else {
    console.log(`Validation error: ${manifest.containerId}`);
    console.log(validateManifest(manifest));
  }
}


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:155.0) Gecko/20100101 Firefox/155.0

Challenge Information:

Build a Cargo Manifest Validator - Build a Cargo Manifest Validator

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-cargo-manifest-validator/69a56b5069ca99f7317e6e19.md at main · freeCodeCamp/freeCodeCamp · GitHub

consider an object like

{ containerId: -6,
  destination: 123,
  weight: 0,
  unit: 'pounds',
  hazmat: true }

which of these properties are invalid?