UNPKG

ts-mls

Version:

[![CI](https://github.com/LukaJCB/ts-mls/actions/workflows/ci.yml/badge.svg)](https://github.com/LukaJCB/ts-mls/actions/workflows/ci.yml) [![npm version](https://badge.fury.io/js/ts-mls.svg)](https://badge.fury.io/js/ts-mls) [![Coverage Status](https://co

51 lines 1.87 kB
import { extensionsEqual } from "../src/extension"; describe("extensionsEqual", () => { test("should return true for identical extensions", () => { const ext1 = { extensionType: "application_id", extensionData: new Uint8Array([1, 2, 3]), }; const ext2 = { extensionType: "application_id", extensionData: new Uint8Array([1, 2, 3]), }; expect(extensionsEqual([ext1], [ext2])).toBe(true); }); test("should return false for different extension types", () => { const ext1 = { extensionType: "application_id", extensionData: new Uint8Array([1, 2, 3]), }; const ext2 = { extensionType: "ratchet_tree", extensionData: new Uint8Array([1, 2, 3]), }; expect(extensionsEqual([ext1], [ext2])).toBe(false); }); test("should return false for different extension data", () => { const ext1 = { extensionType: "application_id", extensionData: new Uint8Array([1, 2, 3]), }; const ext2 = { extensionType: "application_id", extensionData: new Uint8Array([1, 2, 4]), }; expect(extensionsEqual([ext1], [ext2])).toBe(false); }); test("should return false for different array lengths", () => { const ext1 = { extensionType: "application_id", extensionData: new Uint8Array([1, 2, 3]), }; const ext2 = { extensionType: "application_id", extensionData: new Uint8Array([1, 2, 3]), }; expect(extensionsEqual([ext1], [ext1, ext2])).toBe(false); }); test("should return true for empty arrays", () => { expect(extensionsEqual([], [])).toBe(true); }); }); //# sourceMappingURL=extensionsEqual.test.js.map