Build a Smart Pantry Restocker - Construir un reabastecedor inteligente de despensa

Cuéntanos qué está pasando:

me da error en el test 17 y no puedo poner variables debajo de las funciones porque fallan todos los demás test. Ayuda.

Tu código hasta el momento

function parseShipment(rawData) {
  let parsed = [];
  let seenSkus = new Set();

  for (let line of rawData) {
    if (!line) continue;
    let [sku, name, qty, expires, zone] = line.split("|");
    
    if (!seenSkus.has(sku)) {
      seenSkus.add(sku);
      parsed.push({
        sku,
        name,
        qty: Number(qty),
        expires,
        zone: zone || "general"
      });
    }
  }
  return parsed;
}

function planRestock(pantry, shipment) {
  let actions = [];

  for (let item of shipment) {
    let type = "donate";

    if (item.qty <= 0) {
      type = "discard";
    } else if (pantry.some(p => p.sku === item.sku)) {
      type = "restock";
    }

   
    actions.push({ type, item }); 
  }
  return actions;
}

function groupByZone(actions) {
  let grouped = {};

  for (let action of actions) {
    let zone = action.item.zone || "general";
    if (!grouped[zone]) {
      grouped[zone] = [];
    }
    grouped[zone].push(action);
  }
  return grouped;
}

function clonePantry(pantry) {
  return structuredClone(pantry);
}

Información de tu navegador:

El agente de usuario es: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36 Edg/149.0.0.0

Información del Desafío:

Build a Smart Pantry Restocker - Construir un reabastecedor inteligente de despensa

GitHub Link: i18n-curriculum/curriculum/challenges/espanol/blocks/lab-smart-pantry-restocker/69a5f35669099ed52f8563b1.md at main · freeCodeCamp/i18n-curriculum · GitHub

Welcome to the forum @jm1972mata,

If you click the GitHub link for this challenge and scroll down to – solutions – at the very bottom you’ll see variables created for pantry and rawData and several function calls. Just copy everything from pantry on down and paste it at the bottom of your code and it should pass the tests.

Happy coding