Skip to content

Commit

Permalink
feat: linked user devices
Browse files Browse the repository at this point in the history
  • Loading branch information
kaioken committed Jan 6, 2025
1 parent 5384860 commit 26a1785
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.24.2",
"version": "0.24.3",
"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/modules/users/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class Users {
public async getUserData(withSocial: boolean = false): Promise<UserData> {
const response = await this.client.query({
query: !withSocial ? GET_USER_DATA_QUERY : GET_USER_SOCIAL_DATA_QUERY,
fetchPolicy: 'network-only',
fetchPolicy: 'no-cache',
});

return response.data.me;
Expand Down
20 changes: 20 additions & 0 deletions test/user.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,26 @@ describe('Test the KanvasCore client', () => {
expect(updateUser.firstname).toBe('Max');
});

it('update custom field', async () => {
const client = getClient();
const userInfo = await client.users.getUserData();
const updatedUserInfo: UpdateUserParams = {
firstname: userInfo.firstname,
lastname: userInfo.lastname,
phone_number: userInfo.contact.phone_number,
cell_phone_number: userInfo.contact.cell_phone_number,
custom_fields: [{ name: 'test_custom_fields', data: '0', public: true }]
};

const updateUser = await client.users.updateUserData(
userInfo.id,
updatedUserInfo
);
console.log(updateUser.custom_fields);
expect(updateUser).toBeDefined();
expect(updateUser.firstname).toBe('Max');
});

it('gets user total following', async () => {
const client = getClient();
const userInfo = await client.users.getUserData(true);
Expand Down

0 comments on commit 26a1785

Please sign in to comment.