Align NaCl functions with Rust tests (#72)

* Align nacl functions with Rust tests

* Match tests from Rust
This commit is contained in:
Jaco Greeff
2018-02-02 13:02:55 +01:00
committed by GitHub
parent eb4b4c74bb
commit a5518ce830
9 changed files with 164 additions and 46 deletions
+20
View File
@@ -0,0 +1,20 @@
// Copyright 2017-2018 Jaco Greeff
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
const { u8aFromString } = require('./index');
describe('u8aFromString', () => {
it('encodes a string byte for byte', () => {
expect(
u8aFromString('12345678901234567890123456789012')
).toEqual(
new Uint8Array([
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34,
0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32
])
);
});
});