From 5774306ed8765f71d3a2b3be9b0e047317d8d248 Mon Sep 17 00:00:00 2001 From: Foivos Date: Wed, 19 Jun 2024 16:17:51 +0300 Subject: [PATCH] prettier and include mocha --- move/abi/Move.toml | 4 ++-- package.json | 7 ++++--- test/test.js | 11 ++++------- test/utils.js | 21 +++++++++------------ 4 files changed, 19 insertions(+), 24 deletions(-) diff --git a/move/abi/Move.toml b/move/abi/Move.toml index d8d50dd3..459fdd59 100644 --- a/move/abi/Move.toml +++ b/move/abi/Move.toml @@ -1,11 +1,11 @@ [package] name = "Abi" version = "0.1.0" -published-at = "0x1bc4c0259a0427f239bc6464548dc47d3beac0c2c55aec9b33323084d04dcddf" +published-at = "0x0" edition = "2024.beta" [dependencies] Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "mainnet-v1.25.3" } [addresses] -abi = "0x1bc4c0259a0427f239bc6464548dc47d3beac0c2c55aec9b33323084d04dcddf" +abi = "0x0" diff --git a/package.json b/package.json index 401e0cd6..ff954392 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,8 @@ "test-js": "npx mocha", "test": "npm run test-move && npm run test-js", "coverage": "./scripts/coverage.sh", - "lint": "eslint --fix './src/*.ts'", - "prettier": "prettier --write './src/*.ts'", + "lint": "eslint --fix './src/*.ts' './test/*.js'", + "prettier": "prettier --write './src/*.ts' './test/*.js'", "compile": "npx tsc", "postinstall": "npm run compile" }, @@ -45,7 +45,8 @@ "eslint": "^8.57.0", "eslint-config-richardpringle": "^2.0.0", "prettier": "^2.8.7", - "prettier-plugin-sort-imports": "^1.8.5" + "prettier-plugin-sort-imports": "^1.8.5", + "mocha": "^10.4.0" }, "description": "Axelar Sui Move contracts" } diff --git a/test/test.js b/test/test.js index 9e3c1e9d..ee9daeb0 100644 --- a/test/test.js +++ b/test/test.js @@ -1,5 +1,4 @@ require('dotenv').config(); -const { TxBuilder } = require('../dist/tx-builder'); const { SuiClient, getFullnodeUrl } = require('@mysten/sui.js/client'); const { Ed25519Keypair } = require('@mysten/sui.js/keypairs/ed25519'); const { requestSuiFromFaucetV0, getFaucetHost } = require('@mysten/sui.js/faucet'); @@ -7,7 +6,7 @@ const { publishPackage } = require('./utils'); describe('test', () => { let client, keypair; - before(async() => { + before(async () => { client = new SuiClient({ url: getFullnodeUrl('localnet') }); const privKey = Buffer.from(process.env.SUI_PRIVATE_KEY, 'hex'); @@ -39,12 +38,10 @@ describe('test', () => { result = await publishPackage(client, keypair, 'squid'); const squidPackageId = result.packageId; const squidCap = result.publishTxn.objectChanges.find((change) => change.objectType === `0x2::package::UpgradeCap`).objectId; - + result = await publishPackage(client, keypair, 'test'); const testPackageId = result.packageId; const testCap = result.publishTxn.objectChanges.find((change) => change.objectType === `0x2::package::UpgradeCap`).objectId; }); - it('test', async () => { - - }); -}); \ No newline at end of file + it('test', async () => {}); +}); diff --git a/test/utils.js b/test/utils.js index ed2bed3a..f491cae8 100644 --- a/test/utils.js +++ b/test/utils.js @@ -1,20 +1,17 @@ - -require('dotenv').config(); -const { TxBuilder } = require('../dist/tx-builder'); -const { updateMoveToml } = require('../dist/utils'); - +const { TxBuilder } = require('../dist/tx-builder'); +const { updateMoveToml } = require('../dist/utils'); async function publishPackage(client, keypair, packageName) { - const builder = new TxBuilder(client); - await builder.publishPackageAndTransferCap(packageName, keypair.toSuiAddress()); - const publishTxn = await builder.signAndExecute(keypair); + const builder = new TxBuilder(client); + await builder.publishPackageAndTransferCap(packageName, keypair.toSuiAddress()); + const publishTxn = await builder.signAndExecute(keypair); - const packageId = (publishTxn.objectChanges?.find((a) => a.type === 'published') ?? []).packageId; + const packageId = (publishTxn.objectChanges?.find((a) => a.type === 'published') ?? []).packageId; - updateMoveToml(packageName, packageId); - return { packageId, publishTxn }; + updateMoveToml(packageName, packageId); + return { packageId, publishTxn }; } module.exports = { publishPackage, -} \ No newline at end of file +};