
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@archethicjs/ae-contract-test
Advanced tools
Testing suite for WebAssembly smart contract for Archethic Public Blockchain.
Testing suite for WebAssembly smart contract for Archethic Public Blockchain.
The framework simplifies the WASM execution environement by simulating the interaction in/out between WASM and the host application.
npm install @archethicjs/ae-contract-test
Create archethic.config.js file to define configuration for account & network interaction:
{
endpoint: 'https://testnet.archethic.net',
seed: 'PRIVATE_SEED',
upgradeAddress: 'Address allowed to make code upgrade'
}
Create a file in tests/index.spec.ts
import { readFileSync } from "fs";
import { getContract } from "@archethic/contract-testing";
import { Balance } from "@archethic/as-contract-sdk";
import { Address, Result, Transaction, TransactionType } from "@archethic/contract-testing/types";
describe("init", () => {
it("should deploy the contract and initialize the state", async () => {
const wasmBuffer = readFileSync("./dist/contract.wasm");
const contract = await getContract(wasmBuffer, {
transaction: {
data: {
content: "5",
},
} as Transaction
});
expect(contract.state).toStrictEqual({ counter: 25 });
});
});
describe("onUpgrade", () => {
it("should mutate the contract's state with new contract logic", async () => {
const wasmBuffer = readFileSync("./dist/contract.wasm");
const contract = await getContract(wasmBuffer);
expect(contract.state.counter).toBe(0);
const newContract = await contract.upgrade(wasmBuffer);
expect(newContract.state.counter).toBe(10);
});
});
describe("inc", () => {
it("should increment without state", async () => {
const wasmBuffer = readFileSync("./dist/contract.wasm");
const contract = await getContract(wasmBuffer);
const result = contract.inc({ value: 2 });
expect(result?.state.counter).toBe(2);
});
it("should increment with state", async () => {
const wasmBuffer = readFileSync("./dist/contract.wasm");
const contract = await getContract(wasmBuffer);
const result = contract.inc({ state: { counter: 2 } });
expect(result?.state.counter).toBe(3);
});
it("should raise an error when the state is negative", async () => {
const wasmBuffer = readFileSync("./dist/contract.wasm");
const contract = await getContract(wasmBuffer);
expect(() => {
contract.inc({ state: { counter: -2 } });
}).toThrow("state cannot be negative");
});
});
The test framework used several modules:
Thank you for considering to help out with the source code. We welcome contributions from anyone and are grateful for even the smallest of improvement.
Please to follow this workflow:
AGPL
FAQs
Testing suite for WebAssembly smart contract for Archethic Public Blockchain.
We found that @archethicjs/ae-contract-test demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.