-
Notifications
You must be signed in to change notification settings - Fork 214
Expand file tree
/
Copy pathaccount.v1.test.ts
More file actions
37 lines (26 loc) · 1.23 KB
/
Copy pathaccount.v1.test.ts
File metadata and controls
37 lines (26 loc) · 1.23 KB
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
34
35
36
37
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' });
// Wait 1sec to make sure the update happened
await new Promise(resolve => setTimeout(resolve, 1000));
const updatedSettings = await client.v1.accountSettings();
expect(updatedSettings.language).to.eq('en');
await client.v1.updateAccountSettings({ lang: settings.language });
}).timeout(60 * 1000);
});