From 4574f3dd9887c07e580d5a5920a0a31de6df966d Mon Sep 17 00:00:00 2001 From: Pranav P Date: Tue, 26 Aug 2025 14:20:20 +0530 Subject: [PATCH] Fix: test case for big endian machines --- test/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/index.js b/test/index.js index 8a3ceeb..e3448c0 100644 --- a/test/index.js +++ b/test/index.js @@ -5,6 +5,7 @@ var CipherBase = require('../'); var test = require('tape'); var inherits = require('inherits'); +const os = require('os'); test('basic version', function (t) { function Cipher() { @@ -212,7 +213,11 @@ test('handle UInt16Array', function (t) { if (ArrayBuffer.isView && (Buffer.prototype instanceof Uint8Array || Buffer.TYPED_ARRAY_SUPPORT)) { var cipher = new Cipher(); var final = cipher.update(new Uint16Array([1234, 512])).finalName('hex'); - t.equals(final, 'd2040002'); + if ( os.endianness() === "BE") { + t.equals(final, '04d20200'); + } else { + t.equals(final, 'd2040002'); + } } else { t.skip('ArrayBuffer.isView and/or TypedArray not fully supported'); }