forked from PLhery/node-twitter-api-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccount.v1.test.ts
33 lines (24 loc) · 1.12 KB
/
account.v1.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import 'mocha';
import { expect } from 'chai';
import { TwitterApi } from '../src';
import { getUserClient } from '../src/test/utils';
let client: TwitterApi;
describe('Account endpoints for v1.1 API', () => {
before(() => {
client = getUserClient();
});
it('.accountSettings/.updateAccountSettings/.updateAccountProfile - Change account settings & profile', async () => {
const user = await client.currentUser();
const settings = await client.v1.accountSettings();
expect(settings.language).to.be.a('string');
const testBio = 'Hello, test bio ' + String(Math.random());
await client.v1.updateAccountProfile({ description: testBio });
const modifiedUser = await client.currentUser(true);
expect(modifiedUser.description).to.equal(testBio);
await client.v1.updateAccountProfile({ description: user.description as string });
await client.v1.updateAccountSettings({ lang: 'en' });
const updatedSettings = await client.v1.accountSettings();
expect(updatedSettings.language).to.eq('en');
await client.v1.updateAccountSettings({ lang: settings.language });
}).timeout(60 * 1000);
});