2014-10-15 13:36:10 +02:00
|
|
|
var assert = require('assert')
|
2014-10-15 10:42:05 +02:00
|
|
|
var base58check = require('../src/base58check')
|
|
|
|
var bs58check = require('bs58check')
|
|
|
|
var sinon = require('sinon')
|
|
|
|
|
|
|
|
describe('base58check', function() {
|
|
|
|
var param
|
|
|
|
|
|
|
|
beforeEach(function() {
|
|
|
|
param = {}
|
|
|
|
})
|
|
|
|
|
|
|
|
it('wraps bs58check.decode', sinon.test(function() {
|
2014-10-15 13:42:21 +02:00
|
|
|
var expectation = this.mock(bs58check).expects('decode')
|
|
|
|
expectation.once().calledWith(param)
|
|
|
|
expectation.onCall(0).returns('foo')
|
2014-10-15 10:42:05 +02:00
|
|
|
|
2014-10-15 13:36:10 +02:00
|
|
|
assert.equal(base58check.decode(param), 'foo')
|
2014-10-15 10:42:05 +02:00
|
|
|
}))
|
|
|
|
|
|
|
|
it('wraps bs58check.encode', sinon.test(function() {
|
2014-10-15 13:42:21 +02:00
|
|
|
var expectation = this.mock(bs58check).expects('encode')
|
|
|
|
expectation.once().calledWith(param)
|
|
|
|
expectation.onCall(0).returns('foo')
|
2014-10-15 10:42:05 +02:00
|
|
|
|
2014-10-15 13:36:10 +02:00
|
|
|
assert.equal(base58check.encode(param), 'foo')
|
2014-10-15 10:42:05 +02:00
|
|
|
}))
|
|
|
|
})
|