diff options
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 () { |