|  | 
| 1 | 1 | var test = require('tape') | 
| 2 | 2 | var timingSafeEqual = require('timing-safe-equal/browser') | 
| 3 |  | -var bufferShims = require('buffer-shims') | 
|  | 3 | +var Buffer = require('safe-buffer').Buffer | 
| 4 | 4 | test('timingSafeEqual', function (t) { | 
| 5 | 5 |   t.plan(5) | 
| 6 | 6 |   t.strictEqual( | 
| 7 |  | -    timingSafeEqual(bufferShims.from('foo'), bufferShims.from('foo')), | 
|  | 7 | +    timingSafeEqual(Buffer.from('foo'), Buffer.from('foo')), | 
| 8 | 8 |     true, | 
| 9 | 9 |     'should consider equal strings to be equal' | 
| 10 | 10 |   ) | 
| 11 | 11 | 
 | 
| 12 | 12 |   t.strictEqual( | 
| 13 |  | -    timingSafeEqual(bufferShims.from('foo'), bufferShims.from('bar')), | 
|  | 13 | +    timingSafeEqual(Buffer.from('foo'), Buffer.from('bar')), | 
| 14 | 14 |     false, | 
| 15 | 15 |     'should consider unequal strings to be unequal' | 
| 16 | 16 |   ) | 
| 17 | 17 | 
 | 
| 18 | 18 |   t.throws(function () { | 
| 19 |  | -    timingSafeEqual(bufferShims.from([1, 2, 3]), bufferShims.from([1, 2])) | 
|  | 19 | +    timingSafeEqual(Buffer.from([1, 2, 3]), Buffer.from([1, 2])) | 
| 20 | 20 |   }, 'should throw when given buffers with different lengths') | 
| 21 | 21 | 
 | 
| 22 | 22 |   t.throws(function () { | 
| 23 |  | -    timingSafeEqual('not a buffer', bufferShims.from([1, 2])) | 
|  | 23 | +    timingSafeEqual('not a buffer', Buffer.from([1, 2])) | 
| 24 | 24 |   }, 'should throw if the first argument is not a buffer') | 
| 25 | 25 | 
 | 
| 26 | 26 |   t.throws(function () { | 
| 27 |  | -    timingSafeEqual(bufferShims.from([1, 2]), 'not a buffer') | 
|  | 27 | +    timingSafeEqual(Buffer.from([1, 2]), 'not a buffer') | 
| 28 | 28 |   }, 'should throw if the second argument is not a buffer') | 
| 29 | 29 | }) | 
0 commit comments