You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-25 05:23:13 +03:00
25 lines
765 B
JavaScript
25 lines
765 B
JavaScript
import TestClient from '../TestClient';
|
|
|
|
describe('Login request', function() {
|
|
let client;
|
|
|
|
beforeEach(function() {
|
|
client = new TestClient();
|
|
});
|
|
|
|
afterEach(function() {
|
|
client.stop();
|
|
});
|
|
|
|
it('should store "access_token" and "user_id" if in response', async function() {
|
|
const response = { user_id: 1, access_token: Date.now().toString(16) };
|
|
|
|
client.httpBackend.when('POST', '/login').respond(200, response);
|
|
client.httpBackend.flush('/login', 1, 100);
|
|
await client.client.login('m.login.any', { user: 'test', password: '12312za' });
|
|
|
|
expect(client.client.getAccessToken()).toBe(response.access_token);
|
|
expect(client.client.getUserId()).toBe(response.user_id);
|
|
});
|
|
});
|