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
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nem2-sdk",
"version": "0.10.3-1",
"version": "0.10.3-2",
"description": "Reactive Nem2 sdk for typescript and javascript",
"scripts": {
"pretest": "npm run build",
Expand Down
15 changes: 10 additions & 5 deletions test/model/transaction/Deadline.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,21 @@
*/

import {expect} from 'chai';
import {ChronoUnit} from 'js-joda';
import {ChronoUnit, Instant, LocalDateTime, ZoneId} from 'js-joda';
import {Deadline} from '../../../src/model/transaction/Deadline';

describe('Deadline', () => {
it('should createComplete timestamp today', () => {
const deadline = Deadline.create();
const date = new Date();
expect(deadline.value.dayOfMonth()).to.be.equal(date.getDate());
expect(deadline.value.monthValue()).to.be.equal(date.getMonth() + 1);
expect(deadline.value.year()).to.be.equal(date.getFullYear());

// avoid SYSTEM and UTC differences
const networkTimeStamp = (new Date()).getTime();
const timestampLocal = LocalDateTime.ofInstant(Instant.ofEpochMilli(networkTimeStamp), ZoneId.SYSTEM);
const reproducedDate = timestampLocal.plus(2, ChronoUnit.HOURS);

expect(deadline.value.dayOfMonth()).to.be.equal(reproducedDate.dayOfMonth());
expect(deadline.value.monthValue()).to.be.equal(reproducedDate.monthValue());
expect(deadline.value.year()).to.be.equal(reproducedDate.year());
});

it('should throw error deadline smaller than timeStamp', () => {
Expand Down