Skip to content

Commit

Permalink
refactor: factorize goerli tests (#893)
Browse files Browse the repository at this point in the history
* refactor: factorize goerli tests

* refactor: testSuite to testProvider

* fix: delete goerli aggregator

* feat: add void goerli chainlinkAggregator
  • Loading branch information
rom1trt committed Aug 3, 2022
1 parent 2495d00 commit 282dbc2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 53 deletions.
8 changes: 0 additions & 8 deletions packages/currency/src/aggregators/goerli.json

This file was deleted.

1 change: 1 addition & 0 deletions packages/currency/src/chainlink-path-aggregators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export type CurrencyPairs = Record<string, Record<string, number>>;
export const chainlinkCurrencyPairs: Record<string, CurrencyPairs> = {
private: privateAggregator,
rinkeby: rinkebyAggregator,
goerli: {},
mainnet: mainnetAggregator,
matic: maticAggregator,
fantom: fantomAggregator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('api/any/conversion-fee-proxy-contract', () => {
});
});

it(`can createExtensionsDataForCreation with fee amount and address ${network}`, async () => {
it(`can createExtensionsDataForCreation with fee amount and address on ${network}`, async () => {
await anyToErc20Proxy.createExtensionsDataForCreation({
feeAddress: 'fee address',
feeAmount: '2000',
Expand All @@ -103,27 +103,6 @@ describe('api/any/conversion-fee-proxy-contract', () => {
testSuite('rinkeby');
testSuite('goerli');

it('can createExtensionsDataForCreation with fee amount and address (Goerli)', async () => {
await anyToErc20Proxy.createExtensionsDataForCreation({
feeAddress: 'fee address',
feeAmount: '2000',
paymentAddress: 'ethereum address',
salt: 'ea3bc7caf64110ca',
acceptedTokens: ['ethereum address2'],
network: 'goerli',
});

expect(createCreationAction).toHaveBeenCalledWith({
feeAddress: 'fee address',
feeAmount: '2000',
paymentAddress: 'ethereum address',
refundAddress: undefined,
salt: 'ea3bc7caf64110ca',
acceptedTokens: ['ethereum address2'],
network: 'goerli',
});
});

it('can createExtensionsDataForCreation without salt', async () => {
await anyToErc20Proxy.createExtensionsDataForCreation({
paymentAddress: 'ethereum address',
Expand Down
7 changes: 0 additions & 7 deletions packages/payment-detection/test/provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ describe('getDefaultProvider', () => {
testSuite('rinkeby', 4);
testSuite('goerli', 5);

it('Can take a standard network (Goerli)', async () => {
const provider = getDefaultProvider('goerli');

expect(provider).toBeInstanceOf(providers.InfuraProvider);
await expect(provider.getNetwork()).resolves.toMatchObject({ chainId: 5 });
});

it('Can take a private network', async () => {
const provider = getDefaultProvider('private') as providers.JsonRpcProvider;

Expand Down
28 changes: 12 additions & 16 deletions packages/payment-processor/test/payment/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,23 +99,19 @@ describe('getNetworkProvider', () => {
expect(getNetworkProvider(request)).toBeInstanceOf(providers.Provider);
});

it('returns a provider for rinkeby', () => {
const request: any = {
currencyInfo: {
network: 'rinkeby',
},
};
expect(getNetworkProvider(request)).toBeInstanceOf(providers.Provider);
});
const testProvider = (network: string) => {
it(`returns a provider for ${network}`, () => {
const request: any = {
currencyInfo: {
network: network,
},
};
expect(getNetworkProvider(request)).toBeInstanceOf(providers.Provider);
});
};

it('returns a provider for goerli', () => {
const request: any = {
currencyInfo: {
network: 'goerli',
},
};
expect(getNetworkProvider(request)).toBeInstanceOf(providers.Provider);
});
testProvider('rinkeby');
testProvider('goerli');

it('fails for other network', () => {
const request: any = {
Expand Down

0 comments on commit 282dbc2

Please sign in to comment.