Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike-CZ committed Nov 7, 2024
1 parent 8d41587 commit a7dc803
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
9 changes: 6 additions & 3 deletions test/NodeDriver.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { ethers } from 'hardhat';
import { ethers, upgrades } from 'hardhat';
import { expect } from 'chai';
import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
import { IEVMWriter, NetworkInitializer, NodeDriver, NodeDriverAuth, UnitTestSFC } from '../typechain-types';
import { IEVMWriter, NetworkInitializer, NodeDriver, NodeDriverAuth } from '../typechain-types';

describe('NodeDriver', () => {
const fixture = async () => {
const [owner, nonOwner] = await ethers.getSigners();
const sfc: UnitTestSFC = await ethers.deployContract('UnitTestSFC');
const sfc = await upgrades.deployProxy(await ethers.getContractFactory('UnitTestSFC'), {
kind: 'uups',
initializer: false,
});
const nodeDriver: NodeDriver = await ethers.deployContract('NodeDriver');
const evmWriter: IEVMWriter = await ethers.deployContract('StubEvmWriter');
const nodeDriverAuth: NodeDriverAuth = await ethers.deployContract('NodeDriverAuth');
Expand Down
13 changes: 5 additions & 8 deletions test/SFC.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { ethers } from 'hardhat';
import { ethers, upgrades } from 'hardhat';
import { expect } from 'chai';
import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
import {
IEVMWriter,
NodeDriver,
NodeDriverAuth,
UnitTestSFC,
UnitTestConstantsManager,
UnitTestNetworkInitializer,
} from '../typechain-types';
Expand All @@ -15,7 +14,10 @@ import { BlockchainNode, ValidatorMetrics } from './helpers/BlockchainNode';
describe('SFC', () => {
const fixture = async () => {
const [owner, user] = await ethers.getSigners();
const sfc: UnitTestSFC = await ethers.deployContract('UnitTestSFC');
const sfc = await upgrades.deployProxy(await ethers.getContractFactory('UnitTestSFC'), {
kind: 'uups',
initializer: false,
});
const nodeDriver: NodeDriver = await ethers.deployContract('NodeDriver');
const evmWriter: IEVMWriter = await ethers.deployContract('StubEvmWriter');
const nodeDriverAuth: NodeDriverAuth = await ethers.deployContract('NodeDriverAuth');
Expand Down Expand Up @@ -241,11 +243,6 @@ describe('SFC', () => {
expect(await this.sfc.owner()).to.equal(this.owner);
});

it('Should succeed and return true if the caller is the owner of the contract', async function () {
expect(await this.sfc.isOwner()).to.equal(true);
expect(await this.sfc.connect(this.user).isOwner()).to.equal(false);
});

it('Should succeed and return address(0) if owner leaves the contract without owner', async function () {
expect(await this.sfc.owner()).to.equal(this.owner);
await this.sfc.renounceOwnership();
Expand Down

0 comments on commit a7dc803

Please sign in to comment.