From 98b4fbb72ea4bc03c8b20fe47c74fc0a27506aba Mon Sep 17 00:00:00 2001 From: Anthony Law Yong Chuan Date: Thu, 5 Aug 2021 00:31:45 +0800 Subject: [PATCH] fix: rename method bufferToResolvedAddress -> bufferToUnresolvedAddress --- rest/src/db/dbFormattingRules.js | 4 ++-- rest/src/db/dbUtils.js | 2 +- rest/test/db/dbUtils_spec.js | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/rest/src/db/dbFormattingRules.js b/rest/src/db/dbFormattingRules.js index 3d9084dd..89ac9bf1 100644 --- a/rest/src/db/dbFormattingRules.js +++ b/rest/src/db/dbFormattingRules.js @@ -19,7 +19,7 @@ * along with Catapult. If not, see . */ -const { longToUint64, bufferToResolvedAddress } = require('./dbUtils'); +const { longToUint64, bufferToUnresolvedAddress } = require('./dbUtils'); const catapult = require('catapult-sdk'); const { Binary } = require('mongodb'); @@ -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) }; diff --git a/rest/src/db/dbUtils.js b/rest/src/db/dbUtils.js index 81e11a40..2d522bdd 100644 --- a/rest/src/db/dbUtils.js +++ b/rest/src/db/dbUtils.js @@ -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; diff --git a/rest/test/db/dbUtils_spec.js b/rest/test/db/dbUtils_spec.js index 914178e4..afd44769 100644 --- a/rest/test/db/dbUtils_spec.js +++ b/rest/test/db/dbUtils_spec.js @@ -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'); @@ -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'); @@ -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);