The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Rocket.Chat/tests/end-to-end/api/00-miscellaneous.js

47 lines
1.3 KiB

/* eslint-env mocha */
/* globals expect */
/* eslint no-unused-vars: 0 */
import {getCredentials, api, login, request, credentials} from '../../data/api-data.js';
import {adminEmail} from '../../data/user.js';
import supertest from 'supertest';
describe('miscellaneous', function() {
this.retries(0);
before(done => getCredentials(done));
describe('API default', () => {
// Required by mobile apps
it('/info', (done) => {
request.get('/api/info')
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('version');
})
.end(done);
});
});
it('/login', () => {
expect(credentials).to.have.property('X-Auth-Token').with.length.at.least(1);
expect(credentials).to.have.property('X-User-Id').with.length.at.least(1);
});
it('/me', (done) => {
request.get(api('me'))
.set(credentials)
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.property('_id', credentials['X-User-Id']);
expect(res.body).to.have.property('username', login.user);
expect(res.body).to.have.property('active');
expect(res.body).to.have.property('name');
expect(res.body).to.have.deep.property('emails[0].address', adminEmail);
})
.end(done);
});
});