Skip to content

Commit 007c638

Browse files
Merge pull request #21 from iExecBlockchainComputing/feature/update-chatid-to-telegram_chatId
Feature/update chatid to telegram chat
2 parents 4b25671 + a2c5794 commit 007c638

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

src/utils/subgraphQuery.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const getValidContact = async (
4141

4242
do {
4343
const variables = {
44-
requiredSchema: ['chatId:string'],
44+
requiredSchema: ['telegram_chatId:string'],
4545
id: contactsAddresses,
4646
start,
4747
range,
@@ -88,7 +88,7 @@ export const checkProtectedDataValidity = async (
8888
): Promise<boolean> => {
8989
try {
9090
const variables = {
91-
requiredSchema: ['chatId:string'],
91+
requiredSchema: ['telegram_chatId:string'],
9292
id: [protectedData],
9393
start: 0,
9494
range: 1,

src/web3telegram/sendTelegram.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export const sendTelegram = async ({
104104
);
105105
if (!isValidProtectedData) {
106106
throw new Error(
107-
'This protected data does not contain "chatId:string" in its schema.'
107+
'This protected data does not contain "telegram_chatId:string" in its schema.'
108108
);
109109
}
110110
const requesterAddress = await iexec.wallet.getAddress();

tests/e2e/fetchMyContacts.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('web3telegram.fetchMyContacts()', () => {
2626
dataProtector = new IExecDataProtector(...getTestConfig(wallet.privateKey));
2727
web3telegram = new IExecWeb3telegram(...getTestConfig(wallet.privateKey));
2828
protectedData = await dataProtector.core.protectData({
29-
data: { chatId: '1461320872' },
29+
data: { telegram_chatId: '12345' },
3030
name: 'test do not use',
3131
});
3232
await waitSubgraphIndexing();

tests/e2e/fetchUserContacts.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ describe('web3telegram.fetchMyContacts()', () => {
2929

3030
//create valid protected data
3131
protectedData1 = await dataProtector.protectData({
32-
data: { chatId: '1234' },
32+
data: { telegram_chatId: '1234' },
3333
name: 'test do not use',
3434
});
3535
protectedData2 = await dataProtector.protectData({
36-
data: { chatId: '5678' },
36+
data: { telegram_chatId: '5678' },
3737
name: 'test do not use',
3838
});
3939
await waitSubgraphIndexing();

tests/e2e/sendTelegram.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ describe('web3telegram.sendTelegram()', () => {
8282
...getTestConfig(providerWallet.privateKey)
8383
);
8484
validProtectedData = await dataProtector.protectData({
85-
data: { chatId: '[email protected]' },
85+
data: { telegram_chatId: '12345' },
8686
name: 'test do not use',
8787
});
8888
//create invalid protected data
@@ -201,7 +201,7 @@ describe('web3telegram.sendTelegram()', () => {
201201
expect(error?.message).toBe('Failed to sendTelegram');
202202
expect(error?.cause).toBeInstanceOf(Error);
203203
expect((error?.cause as Error).message).toBe(
204-
'This protected data does not contain "chatId:string" in its schema.'
204+
'This protected data does not contain "telegram_chatId:string" in its schema.'
205205
);
206206
},
207207
MAX_EXPECTED_WEB2_SERVICES_TIME
@@ -212,7 +212,7 @@ describe('web3telegram.sendTelegram()', () => {
212212
async () => {
213213
//create valid protected data with blank order to not have: datasetorder is fully consumed error from iexec sdk
214214
const protectedData = await dataProtector.protectData({
215-
data: { chatId: '12345' },
215+
data: { telegram_chatId: '12345' },
216216
name: 'test do not use',
217217
});
218218
await waitSubgraphIndexing();
@@ -290,7 +290,7 @@ describe('web3telegram.sendTelegram()', () => {
290290
async () => {
291291
//create valid protected data
292292
const protectedDataForWhitelist = await dataProtector.protectData({
293-
data: { chatId: '[email protected]' },
293+
data: { telegram_chatId: '12345' },
294294
name: 'test do not use',
295295
});
296296
await waitSubgraphIndexing();

tests/unit/utils/subgraphQuery.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe('getValidContact', () => {
6464
expect(graphQLClient.request).toHaveBeenCalledWith(
6565
expect.anything(),
6666
expect.objectContaining({
67-
requiredSchema: ['chatId:string'],
67+
requiredSchema: ['telegram_chatId:string'],
6868
id: ['address1', 'address2', 'address3'],
6969
start: expect.any(Number),
7070
range: 1000,

0 commit comments

Comments
 (0)