-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add zero padding for nanos Signed-off-by: Petar Tonev <[email protected]> * fix unit tests after TransactionId.toString() zero padding Signed-off-by: Petar Tonev <[email protected]> --------- Signed-off-by: Petar Tonev <[email protected]>
- Loading branch information
Showing
4 changed files
with
20 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,25 +66,25 @@ describe("TransactionId", function () { | |
it("should parse {shard}.{realm}.{num}@{seconds}.{nanos}", function () { | ||
const transactionId = TransactionId.fromString("[email protected]"); | ||
|
||
expect(transactionId.toString()).to.be.equal("1.2.3@4.5"); | ||
expect(transactionId.toString()).to.be.equal("1.2.3@4.000000005"); | ||
}); | ||
|
||
it("should parse {num}@{seconds}.{nanos}", function () { | ||
const transactionId = TransactionId.fromString("[email protected]"); | ||
|
||
expect(transactionId.toString()).to.be.equal("0.0.3@4.5"); | ||
expect(transactionId.toString()).to.be.equal("0.0.3@4.000000005"); | ||
}); | ||
|
||
it("should parse {shard}.{realm}.{num}@{seconds}.{nanos}?scheduled", function () { | ||
const transactionId = TransactionId.fromString("[email protected]?scheduled"); | ||
|
||
expect(transactionId.toString()).to.be.equal("1.2.3@4.5?scheduled"); | ||
expect(transactionId.toString()).to.be.equal("1.2.3@4.000000005?scheduled"); | ||
}); | ||
|
||
it("should parse {num}@{seconds}.{nanos}?scheduled", function () { | ||
const transactionId = TransactionId.fromString("[email protected]?scheduled"); | ||
|
||
expect(transactionId.toString()).to.be.equal("0.0.3@4.5?scheduled"); | ||
expect(transactionId.toString()).to.be.equal("0.0.3@4.000000005?scheduled"); | ||
}); | ||
|
||
it("should construct with nonce", function () { | ||
|
@@ -106,11 +106,11 @@ describe("TransactionId", function () { | |
const validStart = new Timestamp(5, 4); | ||
let transactionId = new TransactionId(accountId, validStart, true); | ||
|
||
expect(transactionId.toString()).to.equal("1.1.1@5.4?scheduled"); | ||
expect(transactionId.toString()).to.equal("1.1.1@5.000000004?scheduled"); | ||
|
||
transactionId = new TransactionId(accountId, validStart, true, null); | ||
|
||
expect(transactionId.toString()).to.equal("1.1.1@5.4?scheduled"); | ||
expect(transactionId.toString()).to.equal("1.1.1@5.000000004?scheduled"); | ||
|
||
transactionId = new TransactionId( | ||
accountId, | ||
|
@@ -119,7 +119,7 @@ describe("TransactionId", function () { | |
undefined | ||
); | ||
|
||
expect(transactionId.toString()).to.equal("1.1.1@5.4?scheduled"); | ||
expect(transactionId.toString()).to.equal("1.1.1@5.000000004?scheduled"); | ||
}); | ||
|
||
it("should construct with nonce without scheduled", function () { | ||
|
@@ -133,11 +133,11 @@ describe("TransactionId", function () { | |
nonce | ||
); | ||
|
||
expect(transactionId.toString()).to.equal("1.1.1@5.4/117"); | ||
expect(transactionId.toString()).to.equal("1.1.1@5.000000004/117"); | ||
|
||
transactionId = new TransactionId(accountId, validStart, NaN, nonce); | ||
|
||
expect(transactionId.toString()).to.equal("1.1.1@5.4/117"); | ||
expect(transactionId.toString()).to.equal("1.1.1@5.000000004/117"); | ||
|
||
transactionId = new TransactionId( | ||
accountId, | ||
|
@@ -146,7 +146,7 @@ describe("TransactionId", function () { | |
nonce | ||
); | ||
|
||
expect(transactionId.toString()).to.equal("1.1.1@5.4/117"); | ||
expect(transactionId.toString()).to.equal("1.1.1@5.000000004/117"); | ||
}); | ||
|
||
it("should construct without scheduled and nonce", function () { | ||
|
@@ -159,7 +159,7 @@ describe("TransactionId", function () { | |
null | ||
); | ||
|
||
expect(transactionId.toString()).to.equal("1.1.1@5.4"); | ||
expect(transactionId.toString()).to.equal("1.1.1@5.000000004"); | ||
|
||
transactionId = new TransactionId( | ||
accountId, | ||
|
@@ -168,35 +168,35 @@ describe("TransactionId", function () { | |
undefined | ||
); | ||
|
||
expect(transactionId.toString()).to.equal("1.1.1@5.4"); | ||
expect(transactionId.toString()).to.equal("1.1.1@5.000000004"); | ||
}); | ||
|
||
it("should construct fromString", function () { | ||
let stringId = "[email protected]?scheduled/117"; | ||
let transactionId = TransactionId.fromString(stringId).toString(); | ||
|
||
expect(transactionId).to.eql(stringId); | ||
expect(transactionId).to.eql("[email protected]?scheduled/117"); | ||
}); | ||
|
||
it("should construct fromString without nonce", function () { | ||
let stringId = "[email protected]?scheduled"; | ||
let transactionId = TransactionId.fromString(stringId).toString(); | ||
|
||
expect(transactionId).to.eql(stringId); | ||
expect(transactionId).to.eql("[email protected]?scheduled"); | ||
}); | ||
|
||
it("should construct fromString without scheduled", function () { | ||
let stringId = "[email protected]/117"; | ||
let transactionId = TransactionId.fromString(stringId).toString(); | ||
|
||
expect(transactionId).to.eql(stringId); | ||
expect(transactionId).to.eql("[email protected]/117"); | ||
}); | ||
|
||
it("should construct fromString without nonce and scheduled", function () { | ||
let stringId = "[email protected]"; | ||
let transactionId = TransactionId.fromString(stringId).toString(); | ||
|
||
expect(transactionId).to.eql(stringId); | ||
expect(transactionId).to.eql("[email protected]"); | ||
}); | ||
|
||
it("should be able to update nonce with a number or date", function () { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters