Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/infrastructure/NodeHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ export class NodeHttp extends Http implements NodeRepository {
(body) => {
const nodeTimeDTO = body;
if (nodeTimeDTO.communicationTimestamps.sendTimestamp && nodeTimeDTO.communicationTimestamps.receiveTimestamp) {
return new NodeTime(UInt64.fromNumericString(nodeTimeDTO.communicationTimestamps.sendTimestamp).toDTO(),
UInt64.fromNumericString(nodeTimeDTO.communicationTimestamps.receiveTimestamp).toDTO());
return new NodeTime(UInt64.fromNumericString(nodeTimeDTO.communicationTimestamps.sendTimestamp),
UInt64.fromNumericString(nodeTimeDTO.communicationTimestamps.receiveTimestamp));
}
throw Error('Node time not available');
},
Expand Down
6 changes: 2 additions & 4 deletions src/model/node/NodeTime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { NetworkType } from '../blockchain/NetworkType';
import { UInt64 } from '../UInt64';
import { RoleType } from './RoleType';
/**
* The node info structure describes basic information of a node.
*/
Expand All @@ -28,9 +26,9 @@ export class NodeTime {
constructor(/**
* The request send timestamp
*/
public readonly sendTimeStamp?: number[],
public readonly sendTimeStamp?: UInt64,
/**
* The request received timestamp
*/
public readonly receiveTimeStamp?: number[] ) {}
public readonly receiveTimeStamp?: UInt64 ) {}
}
8 changes: 5 additions & 3 deletions test/infrastructure/NodeHttp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
RolesTypeEnum,
ServerDTO,
ServerInfoDTO,
StorageInfoDTO
StorageInfoDTO,
} from 'symbol-openapi-typescript-node-client';
import { instance, mock, reset, when } from 'ts-mockito';
import { DtoMapping } from '../../src/core/utils/DtoMapping';
Expand Down Expand Up @@ -125,8 +125,10 @@ describe('NodeHttp', () => {

const nodeTime = await nodeRepository.getNodeTime().toPromise();
expect(nodeTime).to.be.not.null;
expect(nodeTime.receiveTimeStamp).to.deep.equals([1111, 0]);
expect(nodeTime.sendTimeStamp).to.deep.equals([2222, 0]);
if (nodeTime.receiveTimeStamp && nodeTime.sendTimeStamp) {
expect(nodeTime.receiveTimeStamp.toDTO()).to.deep.equals([1111, 0]);
expect(nodeTime.sendTimeStamp.toDTO()).to.deep.equals([2222, 0]);
}
});

it('getNodeTim When No Timestamp', async () => {
Expand Down