Skip to content

Commit 70bb896

Browse files
author
Hyunsik Jeong
committed
Update e2e test cases
The type of the asset type is changed to H160, and the shard ID is split from the asset type.
1 parent 0081140 commit 70bb896

File tree

9 files changed

+386
-151
lines changed

9 files changed

+386
-151
lines changed

test/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"dependencies": {
3939
"chai": "^4.2.0",
4040
"chai-as-promised": "^7.1.1",
41-
"codechain-sdk": "https://github.com/jhs7jhs/codechain-sdk-js.git#remove-approvals-from-unwrap-ccc-lib",
41+
"codechain-sdk": "https://github.com/jhs7jhs/codechain-sdk-js.git#asset-type-split-lib",
4242
"codechain-test-helper": "https://github.com/sgkim126/codechain-test-helper-js.git#refac-lib",
4343
"lodash": "^4.17.11",
4444
"mkdirp": "^0.5.1",

test/src/helper/spawn.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ export default class CodeChain {
468468
if (!awaitMint) {
469469
return { asset: tx.getMintedAsset() };
470470
}
471-
const asset = await this.sdk.rpc.chain.getAsset(tx.tracker(), 0);
471+
const asset = await this.sdk.rpc.chain.getAsset(tx.tracker(), 0, 0);
472472
if (asset === null) {
473473
throw Error(`Failed to mint asset`);
474474
}

test/src/integration.long/orders.test.ts

Lines changed: 249 additions & 105 deletions
Large diffs are not rendered by default.

test/src/integration.long/timelock.test.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ describe("Timelock", function() {
5050
tx.addOutputs({
5151
quantity: 1,
5252
assetType: asset.assetType,
53+
shardId: asset.shardId,
5354
recipient: await node.createP2PKHAddress()
5455
});
5556
await node.signTransactionInput(tx, 0);
@@ -113,6 +114,7 @@ describe("Timelock", function() {
113114
failedTx.addOutputs({
114115
quantity: 1,
115116
assetType: asset.assetType,
117+
shardId: asset.shardId,
116118
recipient: await node.createP2PKHAddress()
117119
});
118120
const invoices1 = await node.sendAssetTransaction(failedTx);
@@ -132,6 +134,7 @@ describe("Timelock", function() {
132134
tx.addOutputs({
133135
quantity: 1,
134136
assetType: asset.assetType,
137+
shardId: asset.shardId,
135138
recipient: await node.createP2PKHAddress()
136139
});
137140
await node.signTransactionInput(tx, 0);
@@ -202,6 +205,7 @@ describe("Timelock", function() {
202205
tx.addOutputs({
203206
quantity: 1,
204207
assetType: asset.assetType,
208+
shardId: asset.shardId,
205209
recipient: await node.createP2PKHAddress()
206210
});
207211
await node.signTransactionInput(tx, 0);
@@ -245,6 +249,7 @@ describe("Timelock", function() {
245249
transferTx.addOutputs(
246250
Array.from(Array(count)).map(_ => ({
247251
assetType: asset.assetType,
252+
shardId: asset.shardId,
248253
quantity: 1,
249254
recipient
250255
}))
@@ -256,7 +261,7 @@ describe("Timelock", function() {
256261

257262
it("2 inputs [Block(4), Block(6)] => Block(6)", async function() {
258263
const assets = await createUTXOs(2);
259-
const { assetType } = assets[0];
264+
const { assetType, shardId } = assets[0];
260265
const tx = node.sdk.core.createTransferAssetTransaction();
261266
tx.addInputs([
262267
assets[0].createTransferInput({
@@ -272,7 +277,7 @@ describe("Timelock", function() {
272277
}
273278
})
274279
]);
275-
tx.addOutputs({ quantity: 2, recipient, assetType });
280+
tx.addOutputs({ quantity: 2, recipient, assetType, shardId });
276281
await node.signTransactionInput(tx, 0);
277282
await node.signTransactionInput(tx, 1);
278283
await node.sendAssetTransaction(tx, { awaitInvoice: false });
@@ -293,7 +298,7 @@ describe("Timelock", function() {
293298

294299
it("2 inputs [Block(6), Block(4)] => Block(4)", async function() {
295300
const assets = await createUTXOs(2);
296-
const { assetType } = assets[0];
301+
const { assetType, shardId } = assets[0];
297302
const tx = node.sdk.core.createTransferAssetTransaction();
298303
tx.addInputs([
299304
assets[0].createTransferInput({
@@ -309,7 +314,7 @@ describe("Timelock", function() {
309314
}
310315
})
311316
]);
312-
tx.addOutputs({ quantity: 2, recipient, assetType });
317+
tx.addOutputs({ quantity: 2, recipient, assetType, shardId });
313318
await node.signTransactionInput(tx, 0);
314319
await node.signTransactionInput(tx, 1);
315320
await node.sendAssetTransaction(tx, { awaitInvoice: false });
@@ -330,7 +335,7 @@ describe("Timelock", function() {
330335

331336
it("2 inputs [Time(0), Block(4)] => Block(4)", async function() {
332337
const assets = await createUTXOs(2);
333-
const { assetType } = assets[0];
338+
const { assetType, shardId } = assets[0];
334339
const tx = node.sdk.core.createTransferAssetTransaction();
335340
tx.addInputs([
336341
assets[0].createTransferInput({
@@ -346,7 +351,7 @@ describe("Timelock", function() {
346351
}
347352
})
348353
]);
349-
tx.addOutputs({ quantity: 2, recipient, assetType });
354+
tx.addOutputs({ quantity: 2, recipient, assetType, shardId });
350355
await node.signTransactionInput(tx, 0);
351356
await node.signTransactionInput(tx, 1);
352357
await node.sendAssetTransaction(tx, { awaitInvoice: false });
@@ -362,7 +367,7 @@ describe("Timelock", function() {
362367

363368
it("2 inputs [Time(now + 3 seconds), Block(4)] => Time(..)", async function() {
364369
const assets = await createUTXOs(2);
365-
const { assetType } = assets[0];
370+
const { assetType, shardId } = assets[0];
366371
const tx = node.sdk.core.createTransferAssetTransaction();
367372
tx.addInputs([
368373
assets[0].createTransferInput({
@@ -378,7 +383,7 @@ describe("Timelock", function() {
378383
}
379384
})
380385
]);
381-
tx.addOutputs({ quantity: 2, recipient, assetType });
386+
tx.addOutputs({ quantity: 2, recipient, assetType, shardId });
382387
await node.signTransactionInput(tx, 0);
383388
await node.signTransactionInput(tx, 1);
384389
await node.sendAssetTransaction(tx, { awaitInvoice: false });

0 commit comments

Comments
 (0)