diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:01:11 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:02:09 +0200 |
commit | 363723fc84f7b8477592e0105aeb331ec9a017af (patch) | |
tree | 29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/cipher-base/test.js | |
parent | 5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff) |
node_modules
Diffstat (limited to 'node_modules/cipher-base/test.js')
-rw-r--r-- | node_modules/cipher-base/test.js | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/node_modules/cipher-base/test.js b/node_modules/cipher-base/test.js index 57d144a55..29d349239 100644 --- a/node_modules/cipher-base/test.js +++ b/node_modules/cipher-base/test.js @@ -1,12 +1,14 @@ -var test = require('tape') +var Buffer = require('safe-buffer').Buffer var CipherBase = require('./') + +var test = require('tape') var inherits = require('inherits') test('basic version', function (t) { - inherits(Cipher, CipherBase) function Cipher () { CipherBase.call(this) } + inherits(Cipher, CipherBase) Cipher.prototype._update = function (input) { t.ok(Buffer.isBuffer(input)) return input @@ -17,16 +19,16 @@ test('basic version', function (t) { var cipher = new Cipher() var utf8 = 'abc123abcd' var update = cipher.update(utf8, 'utf8', 'base64') + cipher.final('base64') - var string = (new Buffer(update, 'base64')).toString() + var string = (Buffer.from(update, 'base64')).toString() t.equals(utf8, string) t.end() }) test('hash mode', function (t) { - inherits(Cipher, CipherBase) function Cipher () { CipherBase.call(this, 'finalName') this._cache = [] } + inherits(Cipher, CipherBase) Cipher.prototype._update = function (input) { t.ok(Buffer.isBuffer(input)) this._cache.push(input) @@ -37,17 +39,17 @@ test('hash mode', function (t) { var cipher = new Cipher() var utf8 = 'abc123abcd' var update = cipher.update(utf8, 'utf8').finalName('base64') - var string = (new Buffer(update, 'base64')).toString() + var string = (Buffer.from(update, 'base64')).toString() t.equals(utf8, string) t.end() }) test('hash mode as stream', function (t) { - inherits(Cipher, CipherBase) function Cipher () { CipherBase.call(this, 'finalName') this._cache = [] } + inherits(Cipher, CipherBase) Cipher.prototype._update = function (input) { t.ok(Buffer.isBuffer(input)) this._cache.push(input) @@ -62,11 +64,12 @@ test('hash mode as stream', function (t) { var utf8 = 'abc123abcd' cipher.end(utf8, 'utf8') var update = cipher.read().toString('base64') - var string = (new Buffer(update, 'base64')).toString() + var string = (Buffer.from(update, 'base64')).toString() t.equals(utf8, string) t.end() }) + test('encodings', function (t) { inherits(Cipher, CipherBase) function Cipher () { |