fix test lint

This commit is contained in:
Matteo Pagliazzi
2019-10-08 20:45:38 +02:00
parent e37f4467f8
commit 85fb5f33aa
367 changed files with 6635 additions and 6080 deletions

View File

@@ -1,13 +1,13 @@
import { v4 as generateUUID } from 'uuid';
import {
generateUser,
translate as t,
} from '../../../../helpers/api-integration/v3';
import { encrypt } from '../../../../../website/server/libs/encryption';
import { v4 as generateUUID } from 'uuid';
describe('GET /email/unsubscribe', () => {
let user;
let testEmail = 'test@habitica.com';
const testEmail = 'test@habitica.com';
beforeEach(async () => {
user = await generateUser();
@@ -22,7 +22,7 @@ describe('GET /email/unsubscribe', () => {
});
it('return error when user is not found', async () => {
let code = encrypt(JSON.stringify({
const code = encrypt(JSON.stringify({
_id: generateUUID(),
}));
@@ -34,34 +34,34 @@ describe('GET /email/unsubscribe', () => {
});
it('unsubscribes a user from email notifications', async () => {
let code = encrypt(JSON.stringify({
const code = encrypt(JSON.stringify({
_id: user._id,
email: user.email,
}));
await user.get(`/email/unsubscribe?code=${code}`);
let unsubscribedUser = await user.get('/user');
const unsubscribedUser = await user.get('/user');
expect(unsubscribedUser.preferences.emailNotifications.unsubscribeFromAll).to.be.true;
});
it('unsubscribes an email from notifications', async () => {
let code = encrypt(JSON.stringify({
const code = encrypt(JSON.stringify({
email: testEmail,
}));
let unsubscribedMessage = await user.get(`/email/unsubscribe?code=${code}`);
const unsubscribedMessage = await user.get(`/email/unsubscribe?code=${code}`);
expect(unsubscribedMessage).to.equal('<h1>Unsubscribed successfully!</h1> You won\'t receive any other email from Habitica.');
});
it('returns okay when email is already unsubscribed', async () => {
let code = encrypt(JSON.stringify({
const code = encrypt(JSON.stringify({
email: testEmail,
}));
let unsubscribedMessage = await user.get(`/email/unsubscribe?code=${code}`);
const unsubscribedMessage = await user.get(`/email/unsubscribe?code=${code}`);
expect(unsubscribedMessage).to.equal('<h1>Unsubscribed successfully!</h1> You won\'t receive any other email from Habitica.');
});