Skip to content

Commit

Permalink
Merge pull request #13 from aragon/OS-1155/clean-not-used-vars-consts…
Browse files Browse the repository at this point in the history
…-funcs

feat: clean not used vars, constants and functions
  • Loading branch information
clauBv23 authored Apr 15, 2024
2 parents f960013 + bbed2e5 commit 9d0c061
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 32 deletions.
17 changes: 8 additions & 9 deletions packages/subgraph/tests/plugin/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ import {
ADDRESS_THREE_STRING,
CONTRACT_ADDRESS_STRING,
DAO_ADDRESS_STRING,
PLUGIN_PROPOSAL_ID,
SNAPSHOT_BLOCK,
ONE,
TWO,
START_DATE,
END_DATE,
ALLOW_FAILURE_MAP,
METADATA,
} from '../utils/constants';
import {
createNewMembersAddedEvent,
Expand All @@ -32,13 +40,6 @@ import {
createGetProposalCall,
createNewMultisigSettingsUpdatedEvent,
createMultisigPluginState,
PLUGIN_PROPOSAL_ID,
SNAPSHOT_BLOCK,
ONE,
TWO,
START_DATE,
END_DATE,
ALLOW_FAILURE_MAP,
} from '../utils/events';
import {
generatePluginEntityId,
Expand Down Expand Up @@ -73,8 +74,6 @@ const proposalEntityId = generateProposalEntityId(
pluginProposalId
);

export const METADATA = 'Some String Data ...';

describe('Plugin', () => {
beforeEach(function () {
let context = new DataSourceContext();
Expand Down
32 changes: 24 additions & 8 deletions packages/subgraph/tests/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,45 @@
import {Address} from '@graphprotocol/graph-ts';

export const ZERO = '0';
export const ONE = '1';
export const TWO = '2';
export const THREE = '3';

// String and Address type constants for test scenarios:
// ADDRESS_ZERO to ADDRESS_SIX: Dummy Ethereum addresses for various test cases.
// DAO_ADDRESS: A placeholder address for a DAO instance.
// CONTRACT_ADDRESS: A placeholder address for a contract instance.
// PLUGIN_SETUP_ID: A mock identifier for a plugin setup in test simulations.
export const ADDRESS_ZERO_STRING = '0x0000000000000000000000000000000000000000';
export const ADDRESS_ZERO = Address.fromString(ADDRESS_ZERO_STRING);
export const ADDRESS_ONE_STRING = '0x0000000000000000000000000000000000000001';
export const ADDRESS_ONE = Address.fromString(ADDRESS_ONE_STRING);
export const ADDRESS_TWO_STRING = '0x0000000000000000000000000000000000000002';
export const ADDRESS_TWO = Address.fromString(ADDRESS_TWO_STRING);
export const ADDRESS_THREE_STRING =
'0x0000000000000000000000000000000000000003';
export const ADDRESS_THREE = Address.fromString(ADDRESS_THREE_STRING);
export const ADDRESS_FOUR_STRING = '0x0000000000000000000000000000000000000004';
export const ADDRESS_FOUR = Address.fromString(ADDRESS_FOUR_STRING);
export const ADDRESS_FIVE_STRING = '0x0000000000000000000000000000000000000005';
export const ADDRESS_FIVE = Address.fromString(ADDRESS_FIVE_STRING);
export const ADDRESS_SIX_STRING = '0x0000000000000000000000000000000000000006';
export const ADDRESS_SIX = Address.fromString(ADDRESS_SIX_STRING);
export const DAO_ADDRESS_STRING = '0x00000000000000000000000000000000000000da';
export const DAO_ADDRESS = Address.fromString(DAO_ADDRESS_STRING);
export const CONTRACT_ADDRESS_STRING =
'0x00000000000000000000000000000000000000Ad';

export const ADDRESS_ZERO = Address.fromString(ADDRESS_ZERO_STRING);
export const ADDRESS_ONE = Address.fromString(ADDRESS_ONE_STRING);
export const ADDRESS_TWO = Address.fromString(ADDRESS_TWO_STRING);
export const ADDRESS_THREE = Address.fromString(ADDRESS_THREE_STRING);
export const ADDRESS_FOUR = Address.fromString(ADDRESS_FOUR_STRING);
export const ADDRESS_FIVE = Address.fromString(ADDRESS_FIVE_STRING);
export const ADDRESS_SIX = Address.fromString(ADDRESS_SIX_STRING);
export const DAO_ADDRESS = Address.fromString(DAO_ADDRESS_STRING);
export const CONTRACT_ADDRESS = Address.fromString(CONTRACT_ADDRESS_STRING);

export const PLUGIN_SETUP_ID =
'0xfb3fd2c4cd4e19944dd3f8437e67476240cd9e3efb2294ebd10c59c8f1d6817c';

export const PLUGIN_PROPOSAL_ID = ZERO;
export const START_DATE = '1644851000';
export const END_DATE = '1644852000';
export const CREATED_AT = ONE;
export const SNAPSHOT_BLOCK = '100';
export const ALLOW_FAILURE_MAP = '1';

export const METADATA = 'Some String Data ...';
24 changes: 9 additions & 15 deletions packages/subgraph/tests/utils/events/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ import {
DAO_ADDRESS,
CONTRACT_ADDRESS,
CONTRACT_ADDRESS_STRING,
PLUGIN_PROPOSAL_ID,
ALLOW_FAILURE_MAP,
SNAPSHOT_BLOCK,
CREATED_AT,
START_DATE,
END_DATE,
TWO,
THREE,
ZERO,
} from '../constants';
import {
generatePluginEntityId,
Expand All @@ -20,21 +29,6 @@ import {
import {Address, BigInt, Bytes, ethereum} from '@graphprotocol/graph-ts';
import {createMockedFunction, newMockEvent} from 'matchstick-as';

// test data

export const ZERO = '0';
export const ONE = '1';
export const TWO = '2';
export const THREE = '3';

export const PLUGIN_PROPOSAL_ID = ZERO;
export const MIN_PROPOSER_VOTING_POWER = ZERO;
export const START_DATE = '1644851000';
export const END_DATE = '1644852000';
export const CREATED_AT = ONE;
export const SNAPSHOT_BLOCK = '100';
export const ALLOW_FAILURE_MAP = '1';

// events

export function createNewProposalCreatedEvent(
Expand Down

0 comments on commit 9d0c061

Please sign in to comment.