From 34989f8ba9cd2648c03f6a2417e733fb8ff9732b Mon Sep 17 00:00:00 2001 From: mzywang Date: Tue, 21 May 2024 21:31:14 +0000 Subject: [PATCH] fix(lint): auto-fix [ci] --- .github/workflows/CI.yml | 7 ++++--- package.json | 3 ++- src/mappings/factory.ts | 2 +- tests/handlePoolCreated.test.ts | 34 ++++++++++++++++----------------- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f5b01d49..f43f0ffb 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -55,7 +55,7 @@ jobs: build-and-test: needs: lint - name: build + name: build-and-test runs-on: ubuntu-latest steps: @@ -86,7 +86,8 @@ jobs: run: yarn build - name: Build Docker - run: yarn docker:build + run: yarn build:docker - name: Test - run: yarn test + # We need to run test in this mode because github CI is non-interactive + run: yarn test:no-tty diff --git a/package.json b/package.json index 977fb49b..5930e091 100644 --- a/package.json +++ b/package.json @@ -6,11 +6,12 @@ "scripts": { "lint": "eslint . --ext .ts --fix", "build": "run-s codegen && graph build", - "docker:build": "docker build -t matchstick .", + "build:docker": "docker build -t matchstick .", "buildonly": "graph build", "deploy:alchemy": "graph deploy --node https://subgraphs.alchemy.com/api/subgraphs/deploy --ipfs https://ipfs.satsuma.xyz", "codegen": "graph codegen --output-dir src/types/", "test": "graph test -d", + "test:no-tty": "docker run -i --rm --mount type=bind,source=$INIT_CWD,target=/matchstick matchstick", "create-local": "graph create ianlapham/uniswap-v3 --node http://127.0.0.1:8020", "deploy-local": "graph deploy ianlapham/uniswap-v3 --debug --ipfs http://localhost:5001 --node http://127.0.0.1:8020", "deploy": "graph deploy ianlapham/uniswap-v3-subgraph --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ --debug", diff --git a/src/mappings/factory.ts b/src/mappings/factory.ts index a08ff85a..a26652d5 100644 --- a/src/mappings/factory.ts +++ b/src/mappings/factory.ts @@ -18,7 +18,7 @@ export function handlePoolCreated(event: PoolCreated): void { export function handlePoolCreatedHelper( event: PoolCreated, factoryAddress: string = FACTORY_ADDRESS, - whitelistTokens: string[] = WHITELIST_TOKENS, + whitelistTokens: string[] = WHITELIST_TOKENS ): void { // temp fix if (event.params.pool == Address.fromHexString('0x8fe8d9bb8eeba3ed688069c3d6b556c9ca258248')) { diff --git a/tests/handlePoolCreated.test.ts b/tests/handlePoolCreated.test.ts index 8c88f406..c23ec6f0 100644 --- a/tests/handlePoolCreated.test.ts +++ b/tests/handlePoolCreated.test.ts @@ -14,7 +14,7 @@ import { POOL_TICK_SPACING_03, USDC_MAINNET_FIXTURE, USDC_WETH_03_MAINNET_POOL, - WETH_MAINNET_FIXTURE, + WETH_MAINNET_FIXTURE } from './constants' describe('handlePoolCreated', () => { @@ -44,7 +44,7 @@ describe('handlePoolCreated', () => { ['totalValueLockedETH', '0'], ['totalValueLockedUSD', '0'], ['totalValueLockedETHUntracked', '0'], - ['totalValueLockedUSDUntracked', '0'], + ['totalValueLockedUSDUntracked', '0'] ]) assertObjectMatches('Bundle', '1', [['ethPriceUSD', '0']]) @@ -64,7 +64,7 @@ describe('handlePoolCreated', () => { ['totalValueLockedUSDUntracked', '0'], ['txCount', '0'], ['poolCount', '0'], - ['whitelistPools', `[${USDC_WETH_03_MAINNET_POOL}]`], + ['whitelistPools', `[${USDC_WETH_03_MAINNET_POOL}]`] ]) assertObjectMatches('Token', WETH_MAINNET_FIXTURE.address, [ @@ -82,7 +82,7 @@ describe('handlePoolCreated', () => { ['totalValueLockedUSDUntracked', '0'], ['txCount', '0'], ['poolCount', '0'], - ['whitelistPools', `[${USDC_WETH_03_MAINNET_POOL}]`], + ['whitelistPools', `[${USDC_WETH_03_MAINNET_POOL}]`] ]) assertObjectMatches('Pool', USDC_WETH_03_MAINNET_POOL, [ @@ -109,7 +109,7 @@ describe('handlePoolCreated', () => { ['untrackedVolumeUSD', '0'], ['collectedFeesToken0', '0'], ['collectedFeesToken1', '0'], - ['collectedFeesUSD', '0'], + ['collectedFeesUSD', '0'] ]) }) @@ -125,7 +125,7 @@ describe('handlePoolCreated', () => { const usdcAddress = Address.fromString(USDC_MAINNET_FIXTURE.address) createMockedFunction(usdcAddress, 'symbol', 'symbol():(string)').reverts() createMockedFunction(usdcAddress, 'symbol', 'symbol():(bytes32)').returns([ - ethereum.Value.fromBytes(Bytes.fromUTF8('USDC')), + ethereum.Value.fromBytes(Bytes.fromUTF8('USDC')) ]) const symbol = fetchTokenSymbol(usdcAddress) assert.stringEquals(symbol, 'USDC') @@ -135,15 +135,15 @@ describe('handlePoolCreated', () => { const usdcAddress = Address.fromString(USDC_MAINNET_FIXTURE.address) createMockedFunction(usdcAddress, 'symbol', 'symbol():(string)').reverts() createMockedFunction(usdcAddress, 'symbol', 'symbol():(bytes32)').returns([ - ethereum.Value.fromBytes(Bytes.fromHexString(NULL_ETH_HEX_STRING)), + ethereum.Value.fromBytes(Bytes.fromHexString(NULL_ETH_HEX_STRING)) ]) const staticDefinitions: Array = [ { address: Address.fromString(USDC_MAINNET_FIXTURE.address), symbol: 'USDC', name: 'USD Coin', - decimals: BigInt.fromI32(6), - }, + decimals: BigInt.fromI32(6) + } ] const symbol = fetchTokenSymbol(usdcAddress, staticDefinitions) assert.stringEquals(symbol, 'USDC') @@ -170,7 +170,7 @@ describe('handlePoolCreated', () => { const usdcAddress = Address.fromString(USDC_MAINNET_FIXTURE.address) createMockedFunction(usdcAddress, 'name', 'name():(string)').reverts() createMockedFunction(usdcAddress, 'name', 'name():(bytes32)').returns([ - ethereum.Value.fromBytes(Bytes.fromUTF8('USD Coin')), + ethereum.Value.fromBytes(Bytes.fromUTF8('USD Coin')) ]) const name = fetchTokenName(usdcAddress) assert.stringEquals(name, 'USD Coin') @@ -180,15 +180,15 @@ describe('handlePoolCreated', () => { const usdcAddress = Address.fromString(USDC_MAINNET_FIXTURE.address) createMockedFunction(usdcAddress, 'name', 'name():(string)').reverts() createMockedFunction(usdcAddress, 'name', 'name():(bytes32)').returns([ - ethereum.Value.fromBytes(Bytes.fromHexString(NULL_ETH_HEX_STRING)), + ethereum.Value.fromBytes(Bytes.fromHexString(NULL_ETH_HEX_STRING)) ]) const staticDefinitions: Array = [ { address: Address.fromString(USDC_MAINNET_FIXTURE.address), symbol: 'USDC', name: 'USD Coin', - decimals: BigInt.fromI32(6), - }, + decimals: BigInt.fromI32(6) + } ] const name = fetchTokenName(usdcAddress, staticDefinitions) assert.stringEquals(name, 'USD Coin') @@ -207,7 +207,7 @@ describe('handlePoolCreated', () => { test('success - fetch token total supply', () => { const usdcAddress = Address.fromString(USDC_MAINNET_FIXTURE.address) createMockedFunction(usdcAddress, 'totalSupply', 'totalSupply():(uint256)').returns([ - ethereum.Value.fromUnsignedBigInt(BigInt.fromString('300')), + ethereum.Value.fromUnsignedBigInt(BigInt.fromString('300')) ]) const totalSupply = fetchTokenTotalSupply(usdcAddress) assert.bigIntEquals(totalSupply, BigInt.fromString('300')) @@ -225,7 +225,7 @@ describe('handlePoolCreated', () => { test('success - fetch token decimals', () => { const usdcAddress = Address.fromString(USDC_MAINNET_FIXTURE.address) createMockedFunction(usdcAddress, 'decimals', 'decimals():(uint32)').returns([ - ethereum.Value.fromUnsignedBigInt(BigInt.fromI32(6)), + ethereum.Value.fromUnsignedBigInt(BigInt.fromI32(6)) ]) const decimals = fetchTokenDecimals(usdcAddress) assert.assertTrue(decimals == BigInt.fromI32(6)) @@ -239,8 +239,8 @@ describe('handlePoolCreated', () => { address: Address.fromString(USDC_MAINNET_FIXTURE.address), symbol: 'USDC', name: 'USD Coin', - decimals: BigInt.fromI32(6), - }, + decimals: BigInt.fromI32(6) + } ] const decimals = fetchTokenDecimals(usdcAddress, staticDefinitions) assert.assertTrue(decimals == BigInt.fromI32(6))