Skip to content

Commit d6251ee

Browse files
committed
Improved e2e test
1 parent aeea6d5 commit d6251ee

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

e2e/infrastructure/MosaicHttp.spec.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ describe('MosaicHttp', () => {
6666
describe('Setup test MosaicId', () => {
6767

6868
it('Announce MosaicDefinitionTransaction', async () => {
69-
const nonce = MosaicNonce.createFromUint8Array(new Uint8Array([255, 255, 255, 255]));
69+
const nonce = MosaicNonce.createFromUint8Array(new Uint8Array([200, 255, 255, 255]));
7070
mosaicId = MosaicId.createFromNonce(nonce, account.publicAccount);
7171
const mosaicDefinitionTransaction = MosaicDefinitionTransaction.create(
7272
Deadline.create(),
@@ -84,6 +84,11 @@ describe('MosaicHttp', () => {
8484
expect(mosaicDefinitionTransaction.nonce.toHex()).to.be.equal(listenedTransaction.nonce.toHex());
8585
expect(mosaicDefinitionTransaction.nonce).to.deep.equal(listenedTransaction.nonce);
8686
expect(mosaicDefinitionTransaction.getMosaicNonceIntValue()).to.be.equal(listenedTransaction.getMosaicNonceIntValue());
87+
88+
const savedTransaction = await helper.repositoryFactory.createTransactionRepository().getTransaction(signedTransaction.hash).toPromise() as MosaicDefinitionTransaction;
89+
expect(mosaicDefinitionTransaction.nonce.toHex()).to.be.equal(savedTransaction.nonce.toHex());
90+
expect(mosaicDefinitionTransaction.nonce).to.deep.equal(savedTransaction.nonce);
91+
expect(mosaicDefinitionTransaction.getMosaicNonceIntValue()).to.be.equal(savedTransaction.getMosaicNonceIntValue());
8792
});
8893
});
8994

test/core/format/Convert.spec.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,13 +405,26 @@ describe('convert', () => {
405405

406406
describe('uint8ToNumber', () => {
407407
it('should convert to number and back', () => {
408-
const expected = 123456789;
409-
const array = convert.numberToUint8Array(expected, 4);
408+
const input = 123456789;
409+
const array = convert.numberToUint8Array(input, 4);
410410
// Act:
411411
const result = convert.uintArray8ToNumber(array);
412412

413413
// Assert:
414-
expect(result).to.be.equal(expected);
414+
expect(result).to.be.equal(input);
415+
});
416+
});
417+
418+
describe('uint8ToNumber', () => {
419+
it('should convert to number and back when negative', () => {
420+
const input = 123456789 >> (Number.MAX_SAFE_INTEGER);
421+
const array = convert.numberToUint8Array(input, 4);
422+
// Act:
423+
const result = convert.uintArray8ToNumber(array);
424+
425+
// Assert:
426+
expect(result).to.be.equal(123456789);
427+
expect(input).to.be.equal(123456789);
415428
});
416429
});
417430

0 commit comments

Comments
 (0)