Skip to content

Commit 142da27

Browse files
committed
followed Aleix style
1 parent 06cf547 commit 142da27

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"scripts": {
66
"pretest": "npm run build",
77
"test": "mocha --ui bdd --recursive ./dist/test --timeout 90000",
8-
"tran": "mocha --ui bdd --recursive ./dist/test/model/transaction/Transaction.spec --timeout 90000",
98
"test:e2e": "mocha --ui bdd --recursive ./dist/e2e --timeout 90000",
109
"test:all": "mocha --ui bdd --recursive ./dist/ --timeout 90000",
1110
"build": "rm -rf dist/ && tsc",

src/model/transaction/Transaction.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,10 @@ export abstract class Transaction {
163163
* @returns {Transaction}
164164
* @memberof Transaction
165165
*/
166-
public reapplygiven(deadline: Deadline): Transaction {
166+
public replyGiven(deadline: Deadline = Deadline.create()): Transaction {
167167
if (this.isUnannounced()) {
168168
return Object.assign({__proto__: Object.getPrototypeOf(this)}, this, {deadline});
169-
} else {
170-
throw new Error('an Announced transaction can\'t be modified');
171169
}
170+
throw new Error('an Announced transaction can\'t be modified');
172171
}
173172
}

test/model/transaction/Transaction.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ describe('Transaction', () => {
9999
});
100100
});
101101

102-
describe('reapplygiven', () => {
102+
describe('replyGiven', () => {
103103
it('should throw an error if the transaction is announced', () => {
104104
const transaction = new FakeTransaction(TransactionType.TRANSFER,
105105
NetworkType.MIJIN_TEST,
@@ -111,7 +111,7 @@ describe('Transaction', () => {
111111
new TransactionInfo(UInt64.fromUint(100), 1, 'id_hash', 'hash', 'hash'),
112112
);
113113
expect(() => {
114-
transaction.reapplygiven(Deadline.create());
114+
transaction.replyGiven(Deadline.create());
115115
}).to.throws('an Announced transaction can\'t be modified');
116116
});
117117
it('should return a new transaction', () => {
@@ -124,7 +124,7 @@ describe('Transaction', () => {
124124
undefined,
125125
);
126126

127-
const newTransaction = transaction.reapplygiven(Deadline.create());
127+
const newTransaction = transaction.replyGiven(Deadline.create());
128128
expect(newTransaction).to.not.equal(transaction);
129129
});
130130
it('should overide deadline properly', () => {
@@ -137,9 +137,11 @@ describe('Transaction', () => {
137137
undefined,
138138
);
139139

140-
const newTransaction = transaction.reapplygiven(Deadline.create(3));
140+
const newDeadline = Deadline.create(3);
141+
const newTransaction = transaction.replyGiven(newDeadline);
141142
const equal = newTransaction.deadline.value.equals(transaction.deadline.value);
142143
const after = newTransaction.deadline.value.isAfter(transaction.deadline.value);
144+
expect(newTransaction.deadline).to.be.equal(newDeadline);
143145
expect(equal).to.be.equal(false);
144146
expect(after).to.be.equal(true);
145147
});

0 commit comments

Comments
 (0)