UNPKG

rtp.js

Version:

RTP stack for Node.js and browser written in TypeScript

24 lines (23 loc) 1.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const helpers_1 = require("../../utils/helpers"); test('nodeBufferToDataView() and dataViewToNodeBuffer()', () => { const array = new Uint8Array([ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, ]); const view1 = new DataView(array.buffer, array.byteOffset, array.byteLength); const nodeBuffer = (0, helpers_1.dataViewToNodeBuffer)(view1); const view2 = (0, helpers_1.nodeBufferToDataView)(nodeBuffer); expect((0, helpers_1.areDataViewsEqual)(view1, view2)).toBe(true); }); test('nodeBufferToArrayBuffer() and arrayBufferToNodeBuffer()', () => { const array = new Uint8Array([ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, ]); const arrayBuffer1 = array.buffer; const nodeBuffer = (0, helpers_1.arrayBufferToNodeBuffer)(arrayBuffer1); const arrayBuffer2 = (0, helpers_1.nodeBufferToArrayBuffer)(nodeBuffer); const view1 = new DataView(arrayBuffer1); const view2 = new DataView(arrayBuffer2); expect((0, helpers_1.areDataViewsEqual)(view1, view2)).toBe(true); });