diff --git a/package.json b/package.json index e72d576..e0b13de 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,8 @@ "aos:publish": "node tools/bundle-aos.mjs && node tools/publish-aos.mjs", "aos:load": "node tools/bundle-aos.mjs && node tools/load-aos.mjs", "aos:spawn": "node tools/spawn-aos.mjs", - "test": "yarn aos:build && node --test --test-concurrency 1 --experimental-wasm-memory64 **/*.test.mjs", - "integration-coverage": "node tools/analyze-handler-coverage.mjs --luaEntryFile src/common/main.lua --testFilePattern test/**/*.test.mjs --ignoredHandlers ['Evolve']", + "test": "yarn aos:build && node --test --test-concurrency 1 --experimental-wasm-memory64 **/*.test.mjs && yarn integration-coverage", + "integration-coverage": "node tools/analyze-handler-coverage.mjs --luaEntryFile src/common/main.lua --testFilePattern test/**/*.test.mjs", "prepare": "husky" }, "devDependencies": { diff --git a/src/common/main.lua b/src/common/main.lua index 54664c3..7518af0 100644 --- a/src/common/main.lua +++ b/src/common/main.lua @@ -57,10 +57,11 @@ function ant.init() Balance = "Balance", Transfer = "Transfer", TotalSupply = "Total-Supply", - CreditNotice = "Credit-Notice", + -- not implemented - Mint = "Mint", - Burn = "Burn", + -- CreditNotice = "Credit-Notice", + -- Mint = "Mint", + -- Burn = "Burn", } Handlers.add( diff --git a/test/balances.test.mjs b/test/balances.test.mjs index 28fcbbf..706a2bc 100644 --- a/test/balances.test.mjs +++ b/test/balances.test.mjs @@ -22,6 +22,15 @@ describe('aos Balances', async () => { ); } + async function getTotalSupply(mem) { + return handle( + { + Tags: [{ name: 'Action', value: 'Total-Supply' }], + }, + mem, + ); + } + it('should fetch the owner balance', async () => { const result = await handle({ Tags: [ @@ -99,4 +108,11 @@ describe('aos Balances', async () => { ), ); }); + it('should get total supply', async () => { + const res = await getTotalSupply(); + + const totalSupply = res.Messages[0]; + assert(totalSupply, 'failed to get total supply'); + assert(totalSupply.Data == 1, 'total supply should be equal to 1'); + }); }); diff --git a/tools/analyze-handler-coverage.mjs b/tools/analyze-handler-coverage.mjs index 5155938..df2077c 100644 --- a/tools/analyze-handler-coverage.mjs +++ b/tools/analyze-handler-coverage.mjs @@ -98,7 +98,7 @@ function generateCoverageReport(luaHandlers, testedHandlers) { ((luaHandlers.length - untestedHandlers.length) / luaHandlers.length) * 100; const reportLines = []; - reportLines.push(chalk.bold('\nCoverage Report')); + reportLines.push(chalk.bold('\nHandlers Coverage Report')); reportLines.push(`Total Handlers: ${chalk.cyan(luaHandlers.length)}`); reportLines.push( `Tested Handlers: ${chalk.green(luaHandlers.length - untestedHandlers.length)}`,