Skip to content

Commit

Permalink
🧹 Test improvements (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
janjakubnanista authored Feb 9, 2024
1 parent ede6f88 commit f256086
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 82 deletions.
35 changes: 0 additions & 35 deletions packages/devtools-evm-hardhat/src/deployments.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/devtools-evm-hardhat/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import './type-extensions'
export * from './artifacts'
export * from './cli'
export * from './config'
export * from './deployments'
export * from './constants'
export * from './errors'
export * from './internal'
Expand Down
5 changes: 3 additions & 2 deletions packages/devtools-evm/jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as jestExtended from 'jest-extended';

// add all jest-extended matchers
// eslint-disable-next-line @typescript-eslint/no-var-requires
expect.extend(require('jest-extended'));
expect.extend(jestExtended);
5 changes: 3 additions & 2 deletions packages/devtools/jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as jestExtended from 'jest-extended';

// add all jest-extended matchers
// eslint-disable-next-line @typescript-eslint/no-var-requires
expect.extend(require('jest-extended'));
expect.extend(jestExtended);
12 changes: 10 additions & 2 deletions tests/devtools-evm-hardhat-test/jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
import { rmSync } from 'fs';
import * as jestExtended from 'jest-extended';

// add all jest-extended matchers
// eslint-disable-next-line @typescript-eslint/no-var-requires
expect.extend(require('jest-extended'));
expect.extend(jestExtended);

// clear all deployments before & after every test
const clearDeployments = () => rmSync('./deployments', { force: true, recursive: true });

beforeEach(clearDeployments);
afterEach(clearDeployments);
14 changes: 1 addition & 13 deletions tests/devtools-evm-hardhat-test/test/task/deploy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
import hre from 'hardhat'
import { TASK_COMPILE } from 'hardhat/builtin-tasks/task-names'
import { DeploymentsManager } from 'hardhat-deploy/dist/src/DeploymentsManager'
import {
TASK_LZ_DEPLOY,
createClearDeployments,
createGetHreByEid,
getEidForNetworkName,
} from '@layerzerolabs/devtools-evm-hardhat'
import { TASK_LZ_DEPLOY } from '@layerzerolabs/devtools-evm-hardhat'
import { promptForText, promptToContinue, promptToSelectMultiple } from '@layerzerolabs/io-devtools'

jest.mock('@layerzerolabs/io-devtools', () => {
Expand Down Expand Up @@ -49,13 +44,6 @@ describe(`task ${TASK_LZ_DEPLOY}`, () => {
promptToSelectMultipleMock.mockReset()

runDeploySpy.mockClear()

const getHreByEid = createGetHreByEid(hre)
const clearDeployments = createClearDeployments(getHreByEid)

await clearDeployments(getEidForNetworkName('britney'))
await clearDeployments(getEidForNetworkName('tango'))
await clearDeployments(getEidForNetworkName('vengaboys'))
})

it('should be available', () => {
Expand Down
12 changes: 10 additions & 2 deletions tests/ua-devtools-evm-hardhat-test/jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
import { rmSync } from 'fs';
import * as jestExtended from 'jest-extended';

// add all jest-extended matchers
// eslint-disable-next-line @typescript-eslint/no-var-requires
expect.extend(require('jest-extended'));
expect.extend(jestExtended);

// clear all deployments before & after every test
const clearDeployments = () => rmSync('./deployments', { force: true, recursive: true });

beforeEach(clearDeployments);
afterEach(clearDeployments);
19 changes: 0 additions & 19 deletions tests/ua-devtools-evm-hardhat-test/test/__utils__/common.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { omniContractToPoint } from '@layerzerolabs/devtools-evm'
import { printJson } from '@layerzerolabs/io-devtools'
import { OAppEdgeConfig } from '@layerzerolabs/ua-devtools'
import { spawnSync } from 'child_process'
import { cleanAllDeployments } from '../../__utils__/common'

jest.mock('@layerzerolabs/io-devtools', () => {
const original = jest.requireActual('@layerzerolabs/io-devtools')
Expand All @@ -30,11 +29,6 @@ describe(`task ${TASK_LZ_OAPP_CONFIG_GET_DEFAULT}`, () => {
await deployAndSetupDefaultEndpointV2(true)
})

afterAll(async () => {
// We'll be good citizens and clean the endpoint deployments
await cleanAllDeployments()
})

it('should return default configurations with passed in networks param', async () => {
const getDefaultConfigTask = await hre.run(TASK_LZ_OAPP_CONFIG_GET_DEFAULT, { networks })
const contractFactory = createContractFactory()
Expand Down

0 comments on commit f256086

Please sign in to comment.