UNPKG

sorting-algorithms-lib

Version:

sorting-algorithms-lib is a lightweight JavaScript library that provides efficient implementations of various sorting algorithms. Whether you're learning algorithms, benchmarking performance, or building a project that requires sorting, this library has y

14 lines (11 loc) 487 B
import { insertionSort } from "../shortAlgorithms/InsertionSort"; describe("InsertionSort Algorithm", () => { test("InsertionSort should sort an array of numbers", () => { const arr = [7, 4, 5, 2]; expect(insertionSort(arr)).toEqual([2, 4, 5, 7]); }); test("InsertionSort should sort an array of strings", () => { const arr = ["banana", "apple", "cherry", "date"]; expect(insertionSort(arr)).toEqual(["apple", "banana", "cherry", "date"]); }); });