Cash Register Project issue

Hello everybody! For the first time I can’t really figure out myself what’s wrong, so far this is the only project which such an issue.
All the tests are passing by changing the cid and price variables, but they don’t pass all together and I can’t figure out why.

What I mean is this (the remaining two pass by changing cid and price):

This is my code (a little bit messy):

let price = 19.5;
let cid = [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]];

cid = cid.reverse();
const value = {
  "ONE HUNDRED": 100,
  "TWENTY": 20,
  "TEN": 10,
  "FIVE": 5,
  "ONE": 1,
  "QUARTER": 0.25,
  "DIME": 0.10,
  "NICKEL": 0.05,
  "PENNY": 0.01
};
const remapped = [];
cid.forEach(e => {
  const data = {
    name: e[0],
    value: value[e[0]],
    amount: Math.round(e[1] / value[e[0]]),
    total: e[1]
  }
  remapped.push(data);
});

const cidTotal = () => {
  let total = 0;
  cid.forEach(e => {
    total += e[1];
  })
  return total;
};

const input = document.getElementById("cash");
const changeDue = document.getElementById("change-due");
const button = document.getElementById("purchase-btn");

const getChange = (amount) => {
  let result = "";
  let changeLeft = amount - price;
  for(let el of Object.values(remapped)) {
    changeLeft = Math.round(changeLeft * 100) / 100;
    if(changeLeft >= el.value && el.total > 0 && changeLeft > 0) {
      const op = parseInt(changeLeft/el.value) * el.value;
      const rOp = (op > el.total) ? el.total : op;
      changeLeft -= rOp;
      cid.forEach((e, index) => {
        if(e[0] === el.name) {
          cid[index][1] = cid[index][1] - rOp;
          return;
        }
      });
      result += ` ${el.name}: \$${rOp}`;
    }
  }
  if(changeLeft > 0 ) return "Status: INSUFFICIENT_FUNDS";
  return changeDue.textContent = `Status: ${cidTotal() > 0 ? "OPEN" : "CLOSED"} ${result}`;
};
  
button.addEventListener("click", () => {
  changeDue.textContent = "";
  const cash = Number(input.value);
  if(!input.value || isNaN(cash)) {
    input.value = "";
    throw alert("You must insert a value");
  }
  if(cash < price) throw alert("Customer does not have enough money to purchase the item");
  if(cash === price) throw changeDue.textContent = "No change due - customer paid with exact cash";
  if(cash - price > cidTotal()) throw changeDue.textContent = "Status: INSUFFICIENT_FUNDS";
  changeDue.textContent = getChange(cash);
});

This suggests code depends on global variables other than the cid, price, or #cash element. When cid or price is changed manually in code, the preview will be reloaded, effectively executing whole code each time. During tests, preview is not reloaded, this means some of the global variables might be stuck with the initial values from when page was loaded.

I’ve started again from scratch and solved the issue