Skip to content

Commit

Permalink
test: replace use of factories with types factories
Browse files Browse the repository at this point in the history
  • Loading branch information
skimaharvey committed Feb 12, 2024
1 parent 2f3eecf commit 768fc1f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 21 deletions.
25 changes: 16 additions & 9 deletions tests/LSP23LinkedContractsDeployment/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { ethers } from 'hardhat';
import { BytesLike } from 'ethers';
import { PromiseOrValue } from '../../types/common';
import { UniversalProfileInit__factory } from 'universalprofile/types';
import {
LSP23LinkedContractsFactory__factory,
UniversalProfileInitPostDeploymentModule__factory,
UniversalProfilePostDeploymentModule__factory,
} from 'lsp23/types';
import { LSP6KeyManagerInit__factory } from 'lsp6/types';

export async function calculateProxiesAddresses(
salt: PromiseOrValue<BytesLike>,
Expand Down Expand Up @@ -60,24 +67,24 @@ export const create16BytesUint = (value: number) => {
};

export async function deployImplementationContracts() {
const KeyManagerInitFactory = await ethers.getContractFactory('LSP6KeyManagerInit');
const [deployer] = await ethers.getSigners();

const KeyManagerInitFactory = new LSP6KeyManagerInit__factory(deployer);
const keyManagerInit = await KeyManagerInitFactory.deploy();

const UniversalProfileInitFactory = await ethers.getContractFactory('UniversalProfileInit');
const UniversalProfileInitFactory = new UniversalProfileInit__factory(deployer);
const universalProfileInit = await UniversalProfileInitFactory.deploy();

const LinkedContractsFactoryFactory = await ethers.getContractFactory(
'LSP23LinkedContractsFactory',
);
const LinkedContractsFactoryFactory = new LSP23LinkedContractsFactory__factory(deployer);
const LSP23LinkedContractsFactory = await LinkedContractsFactoryFactory.deploy();

const UPPostDeploymentManagerFactory = await ethers.getContractFactory(
'UniversalProfilePostDeploymentModule',
const UPPostDeploymentManagerFactory = new UniversalProfilePostDeploymentModule__factory(
deployer,
);
const upPostDeploymentModule = await UPPostDeploymentManagerFactory.deploy();

const UPInitPostDeploymentManagerFactory = await ethers.getContractFactory(
'UniversalProfileInitPostDeploymentModule',
const UPInitPostDeploymentManagerFactory = new UniversalProfileInitPostDeploymentModule__factory(
deployer,
);
const upInitPostDeploymentModule = await UPInitPostDeploymentManagerFactory.deploy();

Expand Down
9 changes: 3 additions & 6 deletions tests/LSP6KeyManager/LSP6ControlledToken.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ import { expect } from 'chai';
import { BytesLike } from 'ethers';
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers';

import { LSP0ERC725Account__factory } from 'lsp0/types';
import { LSP6KeyManager, LSP6KeyManager__factory } from 'lsp6/types';
import { LSP7Mintable, LSP7Mintable__factory } from 'lsp7/types';
import { LSP8Mintable } from 'lsp8/types';
import {
LSP6KeyManager,
LSP6KeyManager__factory,
LSP7Tester__factory,
LSP0ERC725Account__factory,
} from '../../types';
import { LSP7Tester__factory } from '../../types';

import {
ERC725YDataKeys,
Expand Down
9 changes: 4 additions & 5 deletions tests/LSP6KeyManager/LSP6KeyManager.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { BigNumber } from 'ethers';
import { ethers } from 'hardhat';

import {
UniversalProfile__factory,
LSP6KeyManager__factory,
KeyManagerInternalTester__factory,
} from '../../types';
import { KeyManagerInternalTester__factory } from '../../types';

import { UniversalProfile__factory } from 'universalprofile/types';
import { LSP6KeyManager__factory } from 'lsp6/types';

import { LSP6TestContext } from '../utils/context';

Expand Down
3 changes: 2 additions & 1 deletion tests/LSP6KeyManager/LSP6KeyManagerInit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { expect } from 'chai';
import { ethers } from 'hardhat';
import { BigNumber } from 'ethers';
import { LSP6TestContext } from '../utils/context';
import { LSP6KeyManagerInit__factory, UniversalProfileInit__factory } from '../../types';
import { LSP6KeyManagerInit__factory } from '../../types';
import { UniversalProfileInit__factory } from 'universalprofile/types';
import { deployProxy } from '../utils/fixtures';
import { shouldBehaveLikeLSP6, shouldInitializeLikeLSP6 } from './LSP6KeyManager.behaviour';

Expand Down

0 comments on commit 768fc1f

Please sign in to comment.