Skip to content

Commit fd185bb

Browse files
fix tests with the new config
1 parent 06c54c4 commit fd185bb

File tree

8 files changed

+26
-32
lines changed

8 files changed

+26
-32
lines changed

packages/sdk/tests/e2e/dataProtectorSharing/addAppToAppWhitelist.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { HDNodeWallet, Wallet } from 'ethers';
22
import { Address, IExec } from 'iexec';
33
import { ValidationError } from 'yup';
4-
import { DEFAULT_SHARING_CONTRACT_ADDRESS } from '../../../src/config/config.js';
4+
import { CHAIN_CONFIG } from '../../../src/config/config.js';
55
import { IExecDataProtector } from '../../../src/index.js';
66
import {
77
getTestConfig,
@@ -36,7 +36,10 @@ describe('dataProtector.addAppToAddOnlyAppWhitelist()', () => {
3636
const createAppWhitelistResponse =
3737
await dataProtector.sharing.createAddOnlyAppWhitelist();
3838
appWhitelistAddress = createAppWhitelistResponse.addOnlyAppWhitelist;
39-
appAddress = await createAppFor(wallet, DEFAULT_SHARING_CONTRACT_ADDRESS);
39+
appAddress = await createAppFor(
40+
wallet,
41+
CHAIN_CONFIG['134'].sharingContractAddress
42+
);
4043
}, timeouts.createAddOnlyAppWhitelist + timeouts.createAppInPocoRegistry);
4144

4245
describe('When the given addOnlyAppWhitelist is not valid', () => {

packages/sdk/tests/e2e/dataProtectorSharing/addToCollection.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { beforeAll, describe, expect, it, jest } from '@jest/globals';
22
import { type HDNodeWallet, Wallet } from 'ethers';
33
import { IExec } from 'iexec';
4-
import { DEFAULT_SHARING_CONTRACT_ADDRESS } from '../../../src/config/config.js';
4+
import { CHAIN_CONFIG } from '../../../src/config/config.js';
55
import { IExecDataProtector } from '../../../src/index.js';
66
import { approveProtectedDataForCollectionContract } from '../../../src/lib/dataProtectorSharing/smartContract/approveProtectedDataForCollectionContract.js';
77
import { getTestConfig, timeouts } from '../../test-utils.js';
@@ -76,7 +76,7 @@ describe('dataProtector.addToCollection()', () => {
7676
await approveProtectedDataForCollectionContract({
7777
iexec,
7878
protectedData,
79-
sharingContractAddress: DEFAULT_SHARING_CONTRACT_ADDRESS,
79+
sharingContractAddress: CHAIN_CONFIG['134'].sharingContractAddress,
8080
});
8181

8282
// --- WHEN

packages/sdk/tests/e2e/dataProtectorSharing/buyProtectedData.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { beforeAll, describe, expect, it } from '@jest/globals';
22
import { Wallet, type HDNodeWallet } from 'ethers';
33
import { ValidationError } from 'yup';
4-
import { DEFAULT_SHARING_CONTRACT_ADDRESS } from '../../../src/config/config.js';
4+
import { CHAIN_CONFIG } from '../../../src/config/config.js';
55
import { IExecDataProtector } from '../../../src/index.js';
66
import {
77
approveAccount,
@@ -104,7 +104,7 @@ describe('dataProtector.buyProtectedData()', () => {
104104
await depositNRlcForAccount(buyer.address, price);
105105
await approveAccount(
106106
buyer.privateKey,
107-
DEFAULT_SHARING_CONTRACT_ADDRESS,
107+
CHAIN_CONFIG['134'].sharingContractAddress,
108108
price
109109
);
110110

packages/sdk/tests/e2e/dataProtectorSharing/rentProtectedData.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { beforeAll, describe, expect, it } from '@jest/globals';
22
import { HDNodeWallet, Wallet } from 'ethers';
3-
import { DEFAULT_SHARING_CONTRACT_ADDRESS } from '../../../src/config/config.js';
3+
import { CHAIN_CONFIG } from '../../../src/config/config.js';
44
import { IExecDataProtector } from '../../../src/index.js';
55
import {
66
approveAccount,
@@ -154,7 +154,7 @@ describe('dataProtector.rentProtectedData()', () => {
154154
);
155155
await approveAccount(
156156
walletEndUser.privateKey,
157-
DEFAULT_SHARING_CONTRACT_ADDRESS,
157+
CHAIN_CONFIG['134'].sharingContractAddress,
158158
rentingParams.price
159159
);
160160

packages/sdk/tests/e2e/dataProtectorSharing/subscribeToCollection.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { beforeAll, describe, expect, it } from '@jest/globals';
22
import { HDNodeWallet, Wallet } from 'ethers';
3-
import { DEFAULT_SHARING_CONTRACT_ADDRESS } from '../../../src/config/config.js';
3+
import { CHAIN_CONFIG } from '../../../src/config/config.js';
44
import { IExecDataProtector } from '../../../src/index.js';
55
import {
66
approveAccount,
@@ -107,7 +107,7 @@ describe('dataProtector.subscribeToCollection()', () => {
107107
);
108108
await approveAccount(
109109
walletEndUser.privateKey,
110-
DEFAULT_SHARING_CONTRACT_ADDRESS,
110+
CHAIN_CONFIG['134'].sharingContractAddress,
111111
subscriptionParams.price
112112
);
113113

packages/sdk/tests/unit/constructor.test.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22
// needed to access and assert IExecDataProtector's private properties
33
import { describe, it, expect } from '@jest/globals';
44
import { Wallet } from 'ethers';
5-
import {
6-
DEFAULT_CONTRACT_ADDRESS,
7-
DEFAULT_IEXEC_IPFS_NODE,
8-
DEFAULT_IPFS_GATEWAY,
9-
DEFAULT_SUBGRAPH_URL,
10-
} from '../../src/config/config.js';
5+
import { CHAIN_CONFIG } from '../../src/config/config.js';
116
import { IExecDataProtector, getWeb3Provider } from '../../src/index.js';
127

138
describe('IExecDataProtector()', () => {
@@ -58,7 +53,7 @@ describe('IExecDataProtector()', () => {
5853
const dataprotectorContractAddress =
5954
dataProtector['dataprotectorContractAddress'];
6055
expect(dataprotectorContractAddress).toStrictEqual(
61-
DEFAULT_CONTRACT_ADDRESS
56+
CHAIN_CONFIG['134'].dataprotectorContractAddress
6257
);
6358
});
6459

packages/sdk/tests/unit/dataProtectorCore/protectData.test.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ import path from 'path';
33
import { beforeEach, describe, expect, it, jest } from '@jest/globals';
44
import { Wallet, HDNodeWallet, Contract } from 'ethers';
55
import { IExec, utils } from 'iexec';
6-
import {
7-
DEFAULT_CONTRACT_ADDRESS,
8-
DEFAULT_IEXEC_IPFS_NODE,
9-
DEFAULT_IPFS_GATEWAY,
10-
} from '../../../src/config/config.js';
6+
import { CHAIN_CONFIG } from '../../../src/config/config.js';
117
import { type ProtectData } from '../../../src/lib/dataProtectorCore/protectData.js';
128
import { ValidationError, WorkflowError } from '../../../src/utils/errors.js';
139
import { getRandomAddress } from '../../test-utils.js';
@@ -36,9 +32,9 @@ jest.unstable_mockModule('../../../src/utils/getEventFromLogs.js', () => ({
3632
}));
3733

3834
const protectDataDefaultArgs = {
39-
contractAddress: DEFAULT_CONTRACT_ADDRESS,
40-
ipfsNode: DEFAULT_IEXEC_IPFS_NODE,
41-
ipfsGateway: DEFAULT_IPFS_GATEWAY,
35+
contractAddress: CHAIN_CONFIG['134'].dataprotectorContractAddress,
36+
ipfsNode: CHAIN_CONFIG['134'].ipfsNode,
37+
ipfsGateway: CHAIN_CONFIG['134'].ipfsGateway,
4238
};
4339

4440
describe('protectData()', () => {

packages/sdk/tests/unit/dataProtectorSharing/consumeProtectedData.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { describe, expect, it } from '@jest/globals';
22
import { ValidationError } from 'yup';
33
import { consumeProtectedData } from '../../../src/lib/dataProtectorSharing/consumeProtectedData.js';
44
import { getRandomAddress, getRequiredFieldMessage } from '../../test-utils.js';
5-
import { DEFAULT_SHARING_CONTRACT_ADDRESS } from '../../../src/config/config.js';
5+
import { CHAIN_CONFIG } from '../../../src/config/config.js';
66

77
describe('consumeProtectedData', () => {
88
describe('Check validation for input parameters', () => {
@@ -14,7 +14,7 @@ describe('consumeProtectedData', () => {
1414
consumeProtectedData({
1515
// @ts-expect-error No need for iexec here
1616
iexec: {},
17-
sharingContractAddress: DEFAULT_SHARING_CONTRACT_ADDRESS,
17+
sharingContractAddress: CHAIN_CONFIG['134'].sharingContractAddress,
1818
protectedData: missingProtectedData,
1919
app: getRandomAddress(),
2020
})
@@ -32,7 +32,7 @@ describe('consumeProtectedData', () => {
3232
consumeProtectedData({
3333
// @ts-expect-error No need for iexec here
3434
iexec: {},
35-
sharingContractAddress: DEFAULT_SHARING_CONTRACT_ADDRESS,
35+
sharingContractAddress: CHAIN_CONFIG['134'].sharingContractAddress,
3636
protectedData: invalidProtectedData,
3737
app: getRandomAddress(),
3838
})
@@ -52,7 +52,7 @@ describe('consumeProtectedData', () => {
5252
consumeProtectedData({
5353
// @ts-expect-error No need for iexec here
5454
iexec: {},
55-
sharingContractAddress: DEFAULT_SHARING_CONTRACT_ADDRESS,
55+
sharingContractAddress: CHAIN_CONFIG['134'].sharingContractAddress,
5656
protectedData: getRandomAddress(),
5757
app: missingAppAddress,
5858
})
@@ -68,7 +68,7 @@ describe('consumeProtectedData', () => {
6868
consumeProtectedData({
6969
// @ts-expect-error No need for iexec here
7070
iexec: {},
71-
sharingContractAddress: DEFAULT_SHARING_CONTRACT_ADDRESS,
71+
sharingContractAddress: CHAIN_CONFIG['134'].sharingContractAddress,
7272
protectedData: getRandomAddress(),
7373
app: invalidAppAddress,
7474
})
@@ -86,7 +86,7 @@ describe('consumeProtectedData', () => {
8686
consumeProtectedData({
8787
// @ts-expect-error No need for iexec here
8888
iexec: {},
89-
sharingContractAddress: DEFAULT_SHARING_CONTRACT_ADDRESS,
89+
sharingContractAddress: CHAIN_CONFIG['134'].sharingContractAddress,
9090
protectedData: getRandomAddress(),
9191
app: getRandomAddress(),
9292
maxPrice: invalidMaxPrice,
@@ -105,7 +105,7 @@ describe('consumeProtectedData', () => {
105105
consumeProtectedData({
106106
// @ts-expect-error No need for iexec here
107107
iexec: {},
108-
sharingContractAddress: DEFAULT_SHARING_CONTRACT_ADDRESS,
108+
sharingContractAddress: CHAIN_CONFIG['134'].sharingContractAddress,
109109
protectedData: getRandomAddress(),
110110
app: getRandomAddress(),
111111
// @ts-expect-error Type 'number' is not assignable to type 'string'

0 commit comments

Comments
 (0)