UNPKG

@infinito/id3

Version:
18 lines (16 loc) 754 B
import assert from 'assert'; import getSyncSafe from '../src/get.syncsafe.js'; describe('getSyncSafe',function () { it('should throw a TypeError when given something thats not a Uint8Array buffer', function () { assert.throws(() => getSyncSafe(""),TypeError); }); it('should return 0 when given empty Uint8Array', function () { assert.strictEqual(getSyncSafe(new Uint8Array([0,0,0,0])),0); }); it('should return 2113665 when given Uint8Array([1,1,1,1])', function () { assert.strictEqual(getSyncSafe(new Uint8Array([1,1,1,1])),2113665); }); it('should return 0xfffffff when given Uint8Array([0xff,0xff,0xff,0xff])', function () { assert.strictEqual(getSyncSafe(new Uint8Array([0xff,0xff,0xff,0xff])),0xfffffff); }); });