Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test: Fixing old test specs and adding PR test github actions. #139

Merged
merged 5 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cache/token-10.json

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions .github/workflows/pnpm-pr-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: PNPM Build and Test

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm run codegen

- name: Run tests
run: pnpm test
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
"dev": "envio dev",
"codegen": "envio codegen",
"start": "ts-node generated/src/Index.bs.js",
"test": "mocha --require ts-node/register test/**/*.ts",
"test": "mocha --require ts-node/register test/**/*.ts --timeout 20000",
"enable-hydra": "./hack/hydra-mode/hydra-mode.sh"
},
"devDependencies": {
"@types/chai": "^4.3.11",
"@types/node": "^18.16.1",
"@types/sinon": "^17.0.3",
"chai": "4.3.10",
"js-yaml": "4.1.0",
"sinon": "^19.0.2",
"typescript": "^5.0.4",
"web3": "^4.4.0"
},
Expand Down
87 changes: 84 additions & 3 deletions pnpm-lock.yaml

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

12 changes: 6 additions & 6 deletions src/Erc20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ export async function getErc20TokenDetails(
readonly decimals: number;
readonly symbol: string;
}> {
console.log(
`[getErc20TokenDetails] Starting for address: ${contractAddress}, chainId: ${chainId}`
);
// console.log(
// `[getErc20TokenDetails] Starting for address: ${contractAddress}, chainId: ${chainId}`
// );

const cache = Cache.init(CacheCategory.Token, chainId);
const token = cache.read(contractAddress.toLowerCase());

if (token) {
console.log(
`[getErc20TokenDetails] Cache hit for address: ${contractAddress}`
);
// console.log(
// `[getErc20TokenDetails] Cache hit for address: ${contractAddress}`
// );
return {
decimals: Number(token.decimals),
name: token.name,
Expand Down
Loading
Loading