Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Commit

Permalink
fix: rename method bufferToResolvedAddress -> bufferToUnresolvedAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyLaw committed Aug 4, 2021
1 parent 1749391 commit 98b4fbb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions rest/src/db/dbFormattingRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with Catapult. If not, see <http://www.gnu.org/licenses/>.
*/

const { longToUint64, bufferToResolvedAddress } = require('./dbUtils');
const { longToUint64, bufferToUnresolvedAddress } = require('./dbUtils');
const catapult = require('catapult-sdk');
const { Binary } = require('mongodb');

Expand Down Expand Up @@ -50,5 +50,5 @@ module.exports = {
[ModelType.uint64HexIdentifier]: value => uint64.toHex(value instanceof Binary ? uint64.fromBytes(value.buffer) : longToUint64(value)),
[ModelType.int]: value => value.valueOf(),
[ModelType.boolean]: value => value,
[ModelType.encodedAddress]: value => bufferToResolvedAddress(value)
[ModelType.encodedAddress]: value => bufferToUnresolvedAddress(value)
};
2 changes: 1 addition & 1 deletion rest/src/db/dbUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const dbUtils = {
* @param {MongoDb.Binary} binary Address|NamespaceId from MongoDb.
* @returns {string} AddressBase32|NamespaceId
*/
bufferToResolvedAddress: binary => {
bufferToUnresolvedAddress: binary => {
if (!(binary instanceof MongoDb.Binary))
return undefined;

Expand Down
8 changes: 4 additions & 4 deletions rest/test/db/dbUtils_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,13 @@ describe('db utils', () => {
});
});

describe('bufferToResolvedAddress', () => {
describe('bufferToUnresolvedAddress', () => {
it('can convert from buffer to base32 Address', () => {
// Arrange
const object = new Binary(Buffer.from('98E0D138EAF2AC342C015FF0B631EC3622E8AFFA04BFCC56', 'hex'));

// Act:
const result = dbUtils.bufferToResolvedAddress(object);
const result = dbUtils.bufferToUnresolvedAddress(object);

// Assert:
expect(result).to.equal('TDQNCOHK6KWDILABL7YLMMPMGYRORL72AS74YVQ');
Expand All @@ -167,7 +167,7 @@ describe('db utils', () => {
const object = new Binary(Buffer.from('99caab0fd01ccf25ba000000000000000000000000000000', 'hex'));

// Act:
const result = dbUtils.bufferToResolvedAddress(object);
const result = dbUtils.bufferToUnresolvedAddress(object);

// Assert:
expect(result).to.equal('BA25CF1CD00FABCA');
Expand All @@ -178,7 +178,7 @@ describe('db utils', () => {
const object = '99caab0fd01ccf25ba000000000000000000000000000000';

// Act:
const result = dbUtils.bufferToResolvedAddress(object);
const result = dbUtils.bufferToUnresolvedAddress(object);

// Assert:
expect(result).to.equal(undefined);
Expand Down

0 comments on commit 98b4fbb

Please sign in to comment.