Skip to content

Commit

Permalink
Feat(DEVX-410): Reinclude tests
Browse files Browse the repository at this point in the history
remove key

remove logs

continued

cont.

ganache

GH actions workflow tweak
  • Loading branch information
joepegler committed Jan 4, 2024
1 parent dc81a0b commit 73ef0a0
Show file tree
Hide file tree
Showing 26 changed files with 811 additions and 170 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
E2E_PRIVATE_KEY_ONE=
E2E_PRIVATE_KEY_TWO=
E2E_BICO_PAYMASTER_KEY_MUMBAI=
2 changes: 1 addition & 1 deletion .github/workflows/check_branch_name.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
if [[ ! $BRANCH_NAME =~ ^(features/|fixes/|releases/) ]]; then
echo "error: Branch names should follow GitFlow naming convention (features/, fixes/, releases/)."
exit 1
fi
fi
28 changes: 28 additions & 0 deletions .github/workflows/pull_request_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: E2e Test workflow
on: [pull_request, workflow_dispatch]

jobs:
e2e_test:
name: E2E tests
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]

steps:
- name: Checkout
uses: "actions/checkout@main"

- name: Set Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: yarn install --frozen-lockfile && yarn build
- name: Run tests
env:
E2E_PRIVATE_KEY_ONE: ${{ secrets.E2E_PRIVATE_KEY_ONE }}
E2E_PRIVATE_KEY_TWO: ${{ secrets.E2E_PRIVATE_KEY_TWO }}
E2E_BICO_PAYMASTER_KEY_MUMBAI: ${{ secrets.E2E_BICO_PAYMASTER_KEY_MUMBAI }}
run: yarn test:e2e
3 changes: 2 additions & 1 deletion .github/workflows/push_check.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Test workflow
on: push
on: [push, workflow_dispatch]

jobs:
lint:
name: Lint sources
Expand Down
6 changes: 6 additions & 0 deletions jest.config.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import config from "./jest.config";
const e2eConfig = { ...config };
e2eConfig.testMatch = ["**/*.e2e.spec.ts"];
e2eConfig.setupFilesAfterEnv = ["<rootDir>/setup-e2e-tests.ts"];

export default e2eConfig;
10 changes: 7 additions & 3 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const config: Config = {
// setupFiles: [],

// A list of paths to modules that run some code to configure or set up the testing framework before each test
// setupFilesAfterEnv: [],
setupFilesAfterEnv: ["<rootDir>/setup-unit-tests.ts"],

// The number of seconds after which a test is considered as slow and reported as such in the results.
// slowTestThreshold: 5,
Expand All @@ -141,7 +141,7 @@ const config: Config = {
// testLocationInResults: false,

// The glob patterns Jest uses to detect test files
testMatch: ["**/*.spec.ts"],
testMatch: ["**/*.spec.ts", "!**/*.e2e.spec.ts"],

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
// testPathIgnorePatterns: [
Expand Down Expand Up @@ -179,6 +179,10 @@ const config: Config = {

// Whether to use watchman for file crawling
// watchman: true,

globals: {
testDataPerChain: []
}
};

export default config;
export default config;
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"start:ganache": "ganache -m 'direct buyer cliff train rice spirit census refuse glare expire innocent quote'",
"test:ci": "FORCE_COLOR=1 lerna run test:ci --stream --npm-client=yarn",
"test:coverage": "concurrently -k --success first 'yarn start:ganache' 'yarn jest --runInBand --coverage'",
"test:e2e": "yarn test:run --config=jest.config.e2e.ts",
"diff": "lerna diff",
"release": "lerna version patch --no-git-tag-version --no-push --conventional-commits --yes"
},
Expand Down Expand Up @@ -71,7 +72,7 @@
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-security": "^1.7.1",
"ganache": "^7.9.1",
"ganache": "^7.9.2",
"hardhat": "^2.17.3",
"jest": "^29.7.0",
"lerna": "^7.2.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
"access": "public"
},
"devDependencies": {
"nock": "^13.2.9",
"viem": "^1.19.11"
"nock": "^13.2.9"
},
"dependencies": {
"@alchemy/aa-core": "^1.2.2",
Expand Down
20 changes: 20 additions & 0 deletions packages/account/src/BiconomySmartAccountV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,26 @@ export class BiconomySmartAccountV2 extends BaseSmartContractAccount {
}
}

/**
* @param transactions list of transactions to batch
* @param buildUseropDto options for building the userOp
* @returns Promise<UserOpResponse>
*/
async sendTransactions(transactions: Transaction[], buildUseropDto?: BuildUserOpOptions) {

Check warning on line 554 in packages/account/src/BiconomySmartAccountV2.ts

View workflow job for this annotation

GitHub Actions / Lint sources (18.x)

Missing return type on function
const userOp = await this.buildUserOp(transactions, buildUseropDto);
return this.sendUserOp(userOp);
}

/**
* @param transaction single transaction
* @param buildUseropDto options for building the userOp
* @returns Promise<UserOpResponse>
*/
async sendTransaction(transaction: Transaction, buildUseropDto?: BuildUserOpOptions) {

Check warning on line 564 in packages/account/src/BiconomySmartAccountV2.ts

View workflow job for this annotation

GitHub Actions / Lint sources (18.x)

Missing return type on function
const userOp = await this.buildUserOp([transaction], buildUseropDto);
return this.sendUserOp(userOp);
}

async buildUserOp(transactions: Transaction[], buildUseropDto?: BuildUserOpOptions): Promise<Partial<UserOperationStruct>> {
const to = transactions.map((element: Transaction) => element.to as Hex);
const data = transactions.map((element: Transaction) => (element.data as Hex) ?? "0x");
Expand Down
7 changes: 7 additions & 0 deletions packages/account/src/aliases.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { BiconomySmartAccountV2 } from "./BiconomySmartAccountV2";
import { BiconomySmartAccountV2Config } from "./utils/Types";
export { Bundler, IBundler } from "@biconomy/bundler";
export { BiconomyPaymaster as Paymaster, IPaymaster } from "@biconomy/paymaster";

export const createSmartWalletClient = BiconomySmartAccountV2.create;
export type SmartWalletConfig = BiconomySmartAccountV2Config;
1 change: 1 addition & 0 deletions packages/account/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * from "./utils/Types";
export * from "./utils/Constants";
export * from "./BiconomySmartAccountV2";
export * from "./provider";
export * from "./aliases";

This file was deleted.

This file was deleted.

Loading

0 comments on commit 73ef0a0

Please sign in to comment.