Files
habitica/test/api/v3/integration/qrcodes/GET-qrcodes_user.test.js
Keith Holliday 0d28e663e4 New client edit avatar (#8955)
* Fixed some purchasing issues with backgrounds

* Added more background styles

* Fixed some menu styles

* Initial old client removal

* Added cross-env

* removed bower and fixed lint

* Made interceptor errors use notify

* Removed old client tests and fixed lint
2017-08-16 15:51:48 -06:00

34 lines
1014 B
JavaScript

import {
generateUser,
translate as t,
} from '../../../../helpers/api-v3-integration.helper';
import superagent from 'superagent';
import nconf from 'nconf';
const API_TEST_SERVER_PORT = nconf.get('PORT');
xdescribe('GET /qr-code/user/:memberId', () => {
let user;
before(async () => {
user = await generateUser();
});
it('validates req.params.memberId', async () => {
await expect(user.get('/qr-code/user/invalidUUID')).to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('invalidReqParams'),
});
});
it('redirects to profile page', async () => {
let url = `http://localhost:${API_TEST_SERVER_PORT}/qr-code/user/${user._id}`;
let response = await superagent.get(url).end(function (err, res) {
expect(err).to.be(undefined);
return res;
});
expect(response.status).to.eql(200);
expect(response.request.url).to.eql(`http://localhost:${API_TEST_SERVER_PORT}/static/front/#?memberId=${user._id}`);
});
});