Skip to content

Commit 29c4fcb

Browse files
author
fangxiuxiu
committed
Add pre-compiled contract test cases
1 parent 7425812 commit 29c4fcb

2 files changed

Lines changed: 428 additions & 15 deletions

File tree

test/testContractTableTxs.js

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -378,24 +378,18 @@ var table_get = async function () {
378378
});
379379
var str = await myContract.methods.get(owner.address, sTableName, "", "name").call();
380380
console.log(" get with field:", str);
381+
//var raw = "[[],{\"id\":\"1\"}]";
382+
//var raw = "[[],{\"$or\":[{\"email\":\"123\"}, {\"name\": \"zhangsan\"}]}]";
383+
var raw = "{\"name\": { \"$regex\": \"/wangwu/\" }}";
384+
var str = await myContract.methods.get(owner.address, sTableName, raw).call();
385+
console.log(" get with field:", str);
386+
var str = await myContract.methods.get(owner.address, sTableName, raw, "time").call();
387+
console.log(" get with field:", str);
388+
381389
} catch (error) {
382390
console.log(error)
383391
}
384-
// myContract.methods.table(sTableName).get().submit();
385-
// console.log(" all record:", lll);
386-
// myContract.methods.table(sTableName).get({ $or: [{ email: "123" }, { name: "zhangsan" }] }).submit();
387-
// console.log(" record (or)", lll);
388-
// myContract.methods.table(sTableName).get({ name: { $regex: '/s/' } }).submit();
389-
// console.log(" regex record:", lll);
390-
// myContract.methods.table(sTableName).get({ name: { $regex: '/s/' } }).withFields(["COUNT(*) as count"]).submit();
391-
// console.log(" record count:", lll);
392-
// myContract.methods.table(sTableName).get({ name: { $regex: '/s/' } }).withFields([]).submit();
393-
// console.log(" record count:", lll);
394-
// myContract.methods.table(sTableName).get({ name: { $regex: '/s/' } }).limit({ index: 0, total: 1 }).withFields([]).submit();
395-
// console.log(" record count(limit):", lll);
396-
// myContract.methods.table(sTableName).get({ name: { $regex: '/s/' } }).withFields(["account"]).submit();
397-
// console.log(" record with fields:", lll);
398-
}
392+
}
399393
var table_transaction = async function () {
400394
c.as(smUser)
401395
c.use(smRoot.address)

0 commit comments

Comments
 (0)