Skip to content

Commit 4574f3d

Browse files
Fix: test case for big endian machines
1 parent 08ba803 commit 4574f3d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ var CipherBase = require('../');
55

66
var test = require('tape');
77
var inherits = require('inherits');
8+
const os = require('os');
89

910
test('basic version', function (t) {
1011
function Cipher() {
@@ -212,7 +213,11 @@ test('handle UInt16Array', function (t) {
212213
if (ArrayBuffer.isView && (Buffer.prototype instanceof Uint8Array || Buffer.TYPED_ARRAY_SUPPORT)) {
213214
var cipher = new Cipher();
214215
var final = cipher.update(new Uint16Array([1234, 512])).finalName('hex');
215-
t.equals(final, 'd2040002');
216+
if ( os.endianness() === "BE") {
217+
t.equals(final, '04d20200');
218+
} else {
219+
t.equals(final, 'd2040002');
220+
}
216221
} else {
217222
t.skip('ArrayBuffer.isView and/or TypedArray not fully supported');
218223
}

0 commit comments

Comments
 (0)