please fix the code:
const ranks = ["2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"];

class Card {
    constructor(suit, rank) {
        this.suit = suit;
        this.rank = rank;
    }
}

class Combination {
    constructor() {}
    static name = null;
    static id = null;
    static rank = null;

    static test(cards) {}
}


class StraightFlush extends Combination {
    constructor() {}
    static name = "Straight flush";
    static id = 8;
    static rank = 8;

    static test(cards) {
        const counts = {};

        for (let card of cards) {
            counts[card.suit] = (counts[card.suit] || []).concat(card);
        }

        const flusharr = Object.keys(counts).filter((key, i, arr) => {
            if (counts[key].length >= 5) {
                return key;
            }
        });

        if (flusharr.length !== 1) {
            return null;
        }

        let flushCards = counts[flusharr];

        let sorted_rank = [...new Set(flushCards.map((card) => card.rank))].sort((a, b) => Number(b) - Number(a));

        const Ace = sorted_rank.includes("A") && sorted_rank.includes("K");
        const Sequentialized_Ace = ["5", "4", "3", "2"].includes(sorted_rank[0]) && Ace;

        if ((!Ace && sorted_rank.length < 5) || (!Sequentialized_Ace && sorted_rank.length < 5)) {
            return null;
        }
        if (Sequentialized_Ace) {
            sorted_rank.shift();
            sorted_rank.push("A");
        }

        let rank_index = 0,
            possible_straight = [sorted_rank[0]];

        for (let i = 1; i < sorted_rank.length; i++) {
            if (Number(sorted_rank[i - 1]) === Number(sorted_rank[i]) + 1) {
                possible_straight.push(sorted_rank[i]);
            } else if (Number(sorted_rank[i - 1]) !== Number(sorted_rank[i])) {
                rank_index = i;
                possible_straight = [sorted_rank[rank_index]];
            }

            let remainingCards = [];
            for (let i = 0; i < flushCards.length; i++) {
                let test = true;
                if (possible_straight.indexOf(flushCards[i].rank) !== -1) {
                    possible_straight.splice(possible_straight.indexOf(flushCards[i].rank), 1);
                    test = false;
                }

                if (test === true) {
                    remainingCards.push(flushCards[i]);
                }
            }

            if (possible_straight.length === 0) {
                let straightArr = [];
                for (let j = 0; j < flushCards.length; j++) {
                    if (sorted_rank.indexOf(flushCards[j].rank) !== -1) {
                        straightArr.push(flushCards[j]);
                    }
                }

                return {
                    combination: this,
                    cards: straightArr.slice(0, 5),
                };
            }
        }

        return null;
    }
}


////////////////////////////////////

// Define a function to test StraightFlush combination
function testStraightFlush() {

  // Test case 1: straight flush with Ace as the high card
  const cards1 = [
    new Card("hearts", "K"),
    new Card("hearts", "Q"),
    new Card("hearts", "J"),
    new Card("hearts", "10"),
    new Card("hearts", "A"),
    new Card("spades", "9"),
    new Card("clubs", "7"),
  ];
  const result1 = StraightFlush.test(cards1);
 console.log(JSON.stringify(result1));

  // Test case 2: straight flush with Ace followed by five as the low card
  const cards2 = [
    new Card("diamonds", "4"),
    new Card("diamonds", "3"),
    new Card("diamonds", "2"),
    new Card("diamonds", "A"),
    new Card("diamonds", "5"),
    new Card("clubs", "K"),
    new Card("spades", "7")
  ];
  const result2 = StraightFlush.test(cards2);
 console.log(JSON.stringify(result2));


   // Test case 3: flush, but not a straight
   const cards3 = [
     new Card("hearts", "2"),
     new Card("hearts", "4"),
     new Card("hearts", "6"),
     new Card("hearts", "8"),
     new Card("hearts", "A")
   ];
   const result3 = StraightFlush.test(cards3);
 console.log(JSON.stringify(result3));

   // Test case 4: not a flush
	 const cards4 = [
			new Card('spades', 'K'),
			new Card('hearts', '10'),
			new Card('clubs', '5'),
      new Card('diamonds', 'Q'),
      new Card('spades', 'J')
	 ];
	 const result4 = StraightFlush.test(cards4);
 console.log(JSON.stringify(result4));

}
testStraightFlush();
{"cards":[{"suit":"hearts","rank":"K"},{"suit":"hearts","rank":"Q"},{"suit":"hearts","rank":"J"},{"suit":"hearts","rank":"10"},{"suit":"hearts","rank":"A"}]}
tmp.html:132 {"cards":[{"suit":"diamonds","rank":"4"},{"suit":"diamonds","rank":"3"},{"suit":"diamonds","rank":"2"},{"suit":"diamonds","rank":"A"},{"suit":"diamonds","rank":"5"}]}
tmp.html:144 {"cards":[{"suit":"hearts","rank":"2"},{"suit":"hearts","rank":"4"},{"suit":"hearts","rank":"6"},{"suit":"hearts","rank":"8"},{"suit":"hearts","rank":"A"}]}
tmp.html:155 null