message: API: Refactor /api/message tests via TestHelper
diff: -import {FixtureLoader} from '../../fixtures/FixtureLoader';
  -import {Server} from '../../src/server';
  +import {TestHelper} from '../TestHelper';
  import {FixtureUtils} from '../../fixtures/FixtureUtils';
  import {User} from '../../src/models/User';
  -import {IUser} from '../../../shared/models/IUser';
  -import {JwtUtils} from '../../src/security/JwtUtils';
  -import chai = require('chai');
  -import chaiHttp = require('chai-http');
  -chai.use(chaiHttp);
  -const expect = chai.expect;
  -
  -const app = new Server().app;
  const BASE_URL = '/api/message';
  -const fixtureLoader = new FixtureLoader();
  -
  -async function commonRequest(user: IUser, urlPostfix = '', queryOptions?: string | object) {
  - return await chai.request(app)
  - .get(BASE_URL + urlPostfix)
  - .query(queryOptions)
  - .set('Cookie', `token=${JwtUtils.generateToken(user)}`)
  - .catch((err) => err.response);
  -}
  +const expect = TestHelper.commonChaiSetup().expect;
  +const testHelper = new TestHelper(BASE_URL);
  async function testMissingRoom(urlPostfix = '') {
  const admin = await FixtureUtils.getRandomAdmin();
  - const result = await commonRequest(admin, urlPostfix);
  + const result = await testHelper.commonUserGetRequest(admin, urlPostfix);
  expect(result).to.have.status(400);
  }
  @@ -34,7 +18,7 @@ async function testSuccess(urlPostfix = '') {
  const {roomId} = await FixtureUtils.getSimpleChatRoomSetup();
  const admin = await FixtureUtils.getRandomAdmin();
  - const result = await commonRequest(admin, urlPostfix, {room: roomId});
  + const result = await testHelper.commonUserGetRequest(admin, urlPostfix, {room: roomId});
  expect(result).to.have.status(200);
  expect(result).to.be.json;
  @@ -45,16 +29,14 @@ async function testAccessDenial(urlPostfix = '') {
  const {course, roomId} = await FixtureUtils.getSimpleChatRoomSetup();
  const student = await User.findOne({role: 'student', _id: {$nin: course.students}});
  - const result = await commonRequest(student, urlPostfix, {room: roomId});
  + const result = await testHelper.commonUserGetRequest(student, urlPostfix, {room: roomId});
  expect(result).to.have.status(403);
  }
  describe('Message', async () => {
  - // Before each test we reset the database
  beforeEach(async () => {
  - // load fixtures
  - await fixtureLoader.load();
  + await testHelper.resetForNextTest();
  });
  describe(`GET ${BASE_URL}`, async () => {
  