Skip to content

Commit

Permalink
Unit test (#59)
Browse files Browse the repository at this point in the history
* arka success unit test

* modified tests

* removed tests for testing all unit tests

* Added unit test cases of the paymaster

* Added pimlicoPaymaster unit test cases

* MOdified .env file name

* Added assertions in the unit test cases

* Added config.json.default file

---------

Co-authored-by: Vignesh <[email protected]>
  • Loading branch information
Jineshdarjee and vignesha22 authored Feb 12, 2024
1 parent 32fb3a0 commit a741d8c
Show file tree
Hide file tree
Showing 7 changed files with 720 additions and 88 deletions.
38 changes: 36 additions & 2 deletions backend/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
export default {
preset: 'ts-jest',
preset: 'ts-jest/presets/js-with-ts-esm',
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
testEnvironment: 'node',
};
transform: {
'^.+\\.ts?$': [
'ts-jest',
{
useESM: true,
},
],
},
transformIgnorePatterns: [
'node_modules/(?!(data-uri-to-buffer|formdata-polyfill|fetch-blob|node-fetch)/)',
],
testPathIgnorePatterns: [
'/node_modules/',
'/build/'
],
resetModules: true,
testTimeout: 30000,
coverageThreshold: {
global: {
statements: 95,
branches: 75,
functions: 100,
lines: 95,
},
},
coveragePathIgnorePatterns: [
'src/server.ts',
'src/plugins/config.ts',
],
collectCoverage: true,
coverageReporters: ["lcov", "text"]
}
334 changes: 334 additions & 0 deletions backend/src/paymaster/index.test.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion backend/src/paymaster/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class Paymaster {
}
}

async pimlico(userOp: any, gasToken: string, bundlerRpc: string, entryPoint: string, customPaymasterAddress: string) {
async pimlico(userOp: any, gasToken: string, bundlerRpc: string, entryPoint: string, customPaymasterAddress: string | null) {
try {
const provider = new providers.JsonRpcProvider(bundlerRpc);
let erc20Paymaster;
Expand Down
349 changes: 349 additions & 0 deletions backend/src/paymaster/pimlico.test.ts

Large diffs are not rendered by default.

29 changes: 0 additions & 29 deletions backend/test/helper.ts

This file was deleted.

37 changes: 0 additions & 37 deletions backend/test/routes.test.ts

This file was deleted.

19 changes: 0 additions & 19 deletions backend/test/tsconfig.test.json

This file was deleted.

0 comments on commit a741d8c

Please sign in to comment.