3 process.env.DISABLE_MATRIX_BRIDGE = '1';
4 process.env.DISABLE_API_LISTEN = '1';
5 process.env.DISABLE_API_WEB_LISTEN = '1';
7 const fixtureLoader = require('gitter-web-test-utils/lib/test-fixtures');
8 const fixtureUtils = require('gitter-web-test-utils/lib/fixture-utils');
10 const request = require('supertest');
12 const app = require('../../server/web');
14 describe('login', () => {
15 describe('express.js', () => {
16 const fixtures = fixtureLoader.setupEach({
18 accessToken: 'web-internal'
21 uri: 'apiapi/' + fixtureUtils.generateUri(),
31 // tests regression for https://gitlab.com/gitterHQ/webapp/issues/2444
32 // can be removed if we no longer use skipForApi() in express.js
33 it('does not trigger skipForApi wrapper on room uri beginning with api*', async () => {
34 // one of such skipped middlewares is authenticateBearer that is processing the authorisation header
35 // that means it should run on web (e.g. troupe uri) but not on API
37 .get('/' + fixtures.troupeWithApiName1.uri)
38 .set('authorization', `Bearer ${fixtures.user1.accessToken}`)
39 // If the `skipForApi` for `authenticate-bearer` was triggered, we would get a 403 here
40 // This is a room so we should be able to use the `authorization` header