Skip to content

Commit

Permalink
chore: tests contracts progress
Browse files Browse the repository at this point in the history
  • Loading branch information
wsdt committed Jul 30, 2024
1 parent 5889f8d commit aae9e1e
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 39 deletions.
6 changes: 2 additions & 4 deletions contracts/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: "ts-jest",
// testEnvironment: "node",
// moduleNameMapper: {
// '^@/(.*)$': '<rootDir>/src/$1'
// }
testMatch: ["<rootDir>/test/**/*.test.{js,jsx,ts,tsx}"],
testEnvironment: "node",
}
5 changes: 3 additions & 2 deletions contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "jest"
"build": "forge build",
"test": "forge test && jest"
},
"license": "MIT",
"devDependencies": {
Expand All @@ -27,7 +28,7 @@
"@types/supertest": "^6.0.2",
"axios-mock-adapter": "^1.22.0",
"chai": "4",
"ethers": "5",
"ethers": "^6.13.2",
"hardhat": "^2.22.6",
"hardhat-gas-reporter": "^2.2.0",
"jest": "^29.7.0",
Expand Down
62 changes: 31 additions & 31 deletions contracts/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { Contract } from "ethers";

describe("TokenPrice", function () {
let tokenPrice: Contract

it("should call fetchPrice function", async function () {
before(async () => {
const [owner] = await ethers.getSigners();

// Deploy the HybridAccount contract
Expand All @@ -15,8 +16,11 @@ describe("TokenPrice", function () {

// Deploy the TokenPrice contract
const TokenPrice = await ethers.getContractFactory("TokenPrice");
const tokenPrice = await TokenPrice.deploy(hybridAccount.address);
tokenPrice = await TokenPrice.deploy(hybridAccount.address);
await tokenPrice.deployed();
})

it("should call fetchPrice function", async function () {

// Call the fetchPrice function
const tx = await tokenPrice.fetchPrice("ETH");
Expand Down

0 comments on commit aae9e1e

Please sign in to comment.