Skip to content

Commit

Permalink
chore: removed console.logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth9890 committed Nov 27, 2023
1 parent b3d1d20 commit 5ae9722
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 47 deletions.
17 changes: 3 additions & 14 deletions src/user/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ export class User {
async me() {
try {
return await this.sdk.me_query();
} catch (error: any) {
console.log(error.extensions.exception);
} catch (error) {
throw new Error('Something went wrong');
}
}
Expand All @@ -45,7 +44,6 @@ export class User {
try {
return await this.sdk.user_query({ input: { type, value } });
} catch (error) {
console.log(error);
throw new Error('Something went wrong');
}
}
Expand All @@ -61,8 +59,7 @@ export class User {
async myPDACount(filter?: FilterPDAInput) {
try {
return (await this.sdk.myPDACount_query({ filter })).myPDACount;
} catch (error: any) {
console.log(error);
} catch (error) {
throw new Error('Something went wrong');
}
}
Expand All @@ -76,8 +73,7 @@ export class User {
async myPDAs({ filter, order, skip, take }: PDAFilter) {
try {
return await this.sdk.myPDAs_query({ filter, order, skip, take });
} catch (error: any) {
console.log(error);
} catch (error) {
throw new Error('Something went wrong');
}
}
Expand All @@ -95,7 +91,6 @@ export class User {
try {
return (await this.sdk.dataModelsCount_query({ filter })).dataModelsCount;
} catch (error) {
console.log(error);
throw new Error('Something went wrong');
}
}
Expand All @@ -114,7 +109,6 @@ export class User {
return (await this.sdk.myDataRequestTemplatesCount_query({ filter }))
.myDataRequestTemplatesCount;
} catch (error) {
console.log(error);
throw new Error('Something went wrong');
}
}
Expand All @@ -131,7 +125,6 @@ export class User {
try {
return await this.sdk.updateUser_mutation({ input: updatedUser });
} catch (error) {
console.log(error);
throw new Error('Something went wrong');
}
}
Expand All @@ -148,7 +141,6 @@ export class User {
try {
return await this.sdk.updateMyDisplayName_mutation({ displayName });
} catch (error) {
console.log(error);
throw new Error('Something went wrong');
}
}
Expand All @@ -165,7 +157,6 @@ export class User {
try {
return await this.sdk.updateMyGatewayId_mutation({ gatewayId });
} catch (error) {
console.log(error);
throw new Error('Something went wrong');
}
}
Expand All @@ -182,7 +173,6 @@ export class User {
profilePictureUrl,
});
} catch (error) {
console.log(error);
throw new Error('Something went wrong');
}
}
Expand All @@ -199,7 +189,6 @@ export class User {
return (await this.sdk.updateNotificationEmail_mutation({ email }))
.updateNotificationEmail;
} catch (error) {
console.log(error);
throw new Error('Something went wrong');
}
}
Expand Down
52 changes: 19 additions & 33 deletions test/user.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import dotenv from 'dotenv';
import { Gateway } from '../src/Gateway';
import { UserIdentifierType } from '../src/types';
dotenv.config();

const DEFAULT_TIMEOUT = 10000;

let api: Gateway;

beforeAll(() => {
api = new Gateway({
apiKey: 'm9Y5ntNcTlwQ2LbRpYr6K_VhxJXuZJ6Q',
token:
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwcm90b2NvbF9pZCI6IjkwNzcwODA2LWFlMGMtNGExNS05MjYzLWU5MWJhYWY1ZDkzZiIsImF1dGgiOnsiaWQiOiJlMjJiOWZkNi05NjgzLTRjZDgtOGZlOS1lZWU0YzFmYTJjZjciLCJ0eXBlIjoiV0FMTEVUIn0sImNyeXB0byI6eyJwdWJsaWNQZW0iOiItLS0tLUJFR0lOIFBVQkxJQyBLRVktLS0tLVxyXG5NSUlDSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQWc4QU1JSUNDZ0tDQWdFQXpUdTJCWVVSS3VvM2V2MGx0MjUzXHJcblR3SDlGQkhUbU90dlRXYlQraTExSEF5WW5vUGx4UWV3M0cySnAvanNnS0cxbDN4WHBtdEEwVjlkUGxaUHhVS3BcclxueXM2cWNBdkhmaThpdm15dmk1WVhRYnQ4aE1rY3hKb1RzanZ4V092dTF1bjljVlVSUGkzOTJZTjVwV2lBOEdncVxyXG5zMjlvaGYzOVJDVnM4MkxGQlNCVkI0ZHRhRmJ1cnNlY0M1WStqZVB3UG9tLzJMUlpkTTJ3bFc3ZzhYVmNROUV4XHJcblVxSWpxS296YnVjYmpiT0Q2YXZnRm9JR3VpOVIxdzYrbWFLQmRPK1gxRU5tVGZURHhLclZNRFJtSHFOK0syY1ZcclxuK3NlTWEzcDBjT0VlTklOWjc2V2lhTlhwMjErZ0VSU3hIRkRNOVBjeEZYWGxGeVBEWE1oVkNVNm1xTDNXRmtjNFxyXG5uOTI0bC8zR09Sa1QzZmd4K1FqN2krNS9sU0ZQS2Q1R1U3bFN4VnVBb1hwYWQxUlFCWUxBZGo1dnJacjB5aUprXHJcbi94cjMzbVp6Q0NuN0ZhcW1JeDdSbU4vRk1Sc1JqRGdBd2FUb3RzZ05JZFVGZVZrRURCYm1EWnJtL0k5diswY0hcclxuczA0UCtxaG01b3JEaXFscGZoZVN0M3hqVit5a3Z3d0JIOElSeGdIQ0krZk1ZMThBbDBCSHlkckZhdldWbEVhY1xyXG4yRTFpbDFSdXU0OGxCVXliU0R4Y3Z5RXR5TU94N0ErY0dQcy93MGg5aUtZZy9OVnEvTFdwWjEzYmVzcS9QanpWXHJcbjR5ZnZaTkpyT3VxMXpkc29MdlVaUTVuMHJ1c21PekMyNlhMb3BpVlpUSWk3U1k4QzAvNFNlaVVvaU8vaVBFbnhcclxuOW5nL0RUMEsvQXlLbTBZQ1oxU2pwZ1VDQXdFQUFRPT1cclxuLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tXHJcbiJ9LCJ0eXBlIjoiYXV0aF90b2tlbiIsImlhdCI6MTY5ODIxMTg0N30.zUxmPhnrQlIEZ5pMzHBMFkcqPvjsIfs0er9Dylw5olE',
apiKey: process.env.API_KEY!,
token: process.env.BEARER_TOKEN!,
});
});

Expand All @@ -24,15 +25,15 @@ describe('USER Testing', () => {
);

it(
"single user",
'single user',
async () => {
const { user } = await api.user.getSingleUser({
type: UserIdentifierType.GATEWAY_ID,
value: "sid",
value: 'sid',
});
expect(user?.gatewayId).toEqual("sid");
expect(user?.gatewayId).toEqual('sid');
},
DEFAULT_TIMEOUT
DEFAULT_TIMEOUT,
);

it(
Expand Down Expand Up @@ -74,34 +75,19 @@ describe('USER Testing', () => {
DEFAULT_TIMEOUT,
);

// it("update user", async () => {
// const { updateUser } = await api.user.updateUser({
// displayName: "siddharth9890",
// });
// expect(updateUser.displayName).toEqual("siddharth9890");
// });

it('update display username', async () => {
const { updateMyDisplayName } = await api.user.updateMyDisplayName('sid');
expect(updateMyDisplayName).toEqual('sid');
it('update user', async () => {
const { updateUser } = await api.user.updateUser({
displayName: 'siddharth9890',
});
expect(updateUser.displayName).toEqual('siddharth9890');
});

// it("update gateway id", async () => {
// const { updateMyGatewayId } = await api.user.updateMyGatewayId(
// "siddharth9890"
// );
// expect(updateMyGatewayId.gatewayId).toEqual("siddharth9890");
// });

it('update profile picture', async () => {
const { updateMyProfilePicture } =
await api.user.updateMyProfilePicture('siddharth9890');
expect(updateMyProfilePicture).toEqual('siddharth9890');
const { updateMyProfilePicture } = await api.user.updateMyProfilePicture(
'https://www.tryodyssey.xyz/images/campaigns/lifi/odyssey_lifi.png',
);
expect(updateMyProfilePicture).toEqual(
'https://www.tryodyssey.xyz/images/campaigns/lifi/odyssey_lifi.png',
);
});

// it("update notification email", async () => {
// const { user } = await api.user.updateNotificationEmail("[email protected]");
// console.log(user);
// expect(user.email).toEqual("[email protected]");
// });
});

0 comments on commit 5ae9722

Please sign in to comment.