6de2455917
- Added GLOBAL_MARKETS_TITLE to all translation files - Updated footer with 12 markets (4 active + 8 upcoming) - Translated market section to: zh-cn, zh-tw, ja, ko, th, vi, id, ms, hi - Built and deployed to production - CloudFront invalidation: I3RTMXVFDJXWLG3SYX208OP1CC
32 lines
1.2 KiB
JavaScript
32 lines
1.2 KiB
JavaScript
/* eslint-env mocha */
|
|
'use strict'
|
|
|
|
const assert = require('assert')
|
|
const scmp = require('../')
|
|
|
|
// use safe-buffer in case Buffer.from in newer versions of node aren't
|
|
// available
|
|
const Buffer = require('safe-buffer').Buffer
|
|
|
|
describe('scmp', function () {
|
|
it('should return true for identical strings', function () {
|
|
assert(scmp(Buffer.from('a', 'utf8'), Buffer.from('a', 'utf8')))
|
|
assert(scmp(Buffer.from('abc', 'utf8'), Buffer.from('abc', 'utf8')))
|
|
assert(scmp(Buffer.from('e727d1464ae12436e899a726da5b2f11d8381b26', 'hex'), Buffer.from('e727d1464ae12436e899a726da5b2f11d8381b26', 'hex')))
|
|
})
|
|
|
|
it('should return false for non-identical strings', function () {
|
|
assert(!scmp(Buffer.from('a', 'utf8'), Buffer.from('b', 'utf8')))
|
|
assert(!scmp(Buffer.from('abc', 'utf8'), Buffer.from('b', 'utf8')))
|
|
assert(!scmp(Buffer.from('e727d1464ae12436e899a726da5b2f11d8381b26', 'hex'), Buffer.from('e727e1b80e448a213b392049888111e1779a52db', 'hex')))
|
|
})
|
|
|
|
it('should throw errors for non-Buffers', function () {
|
|
assert.throws(scmp.bind(null, 'a', {}))
|
|
assert.throws(scmp.bind(null, {}, 'b'))
|
|
assert.throws(scmp.bind(null, 1, 2))
|
|
assert.throws(scmp.bind(null, undefined, 2))
|
|
assert.throws(scmp.bind(null, null, 2))
|
|
})
|
|
})
|