3 process.env.DISABLE_MATRIX_BRIDGE = '1';
4 process.env.DISABLE_API_LISTEN = '1';
5 process.env.DISABLE_API_WEB_LISTEN = '1';
6 process.env.TEST_EXPORT_RATE_LIMIT = 100;
8 const fixtureLoader = require('gitter-web-test-utils/lib/test-fixtures');
9 const assert = require('assert');
10 const request = require('supertest');
12 const app = require('../../../server/web');
13 const userSettingsService = require('gitter-web-user-settings');
15 describe('user-settings-export-api', function() {
16 fixtureLoader.ensureIntegrationEnvironment('#oauthTokens');
19 if (this._skipFixtureSetup) return;
22 var fixture = fixtureLoader.setup({
24 accessToken: 'web-internal'
27 accessToken: 'web-internal'
31 it('GET /api_web/export/user/:user_id/user-settings.ndjson as same user gets data', async () => {
32 await userSettingsService.setUserSettings(fixture.user1.id, 'test', 'foobar');
33 await userSettingsService.setUserSettings(fixture.userNoExport1.id, 'test', 'noexport');
36 .get(`/api_web/export/user/${fixture.user1.id}/user-settings.ndjson`)
37 .set('Accept', 'application/x-ndjson,application/json')
38 .set('Authorization', `Bearer ${fixture.user1.accessToken}`)
40 .then(function(result) {
42 result.text.split('\n').length,
44 'includes 1 setting item (extra newline at the end)'
46 assert(result.text.includes('"test":"foobar"'), 'includes test user settings');