mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
send email when admin unflags post (#7580)
* send email when admin unflags post * Improved email acquisition code, minor changes to sent email * Refactor getGoupUrl into its own method * added unit test for getGroupUrl * improved test and getGroupUrl
This commit is contained in:
committed by
Blade Barringer
parent
00491670e0
commit
8490b481f6
@@ -5,6 +5,7 @@ import nodemailer from 'nodemailer';
|
||||
import Bluebird from 'bluebird';
|
||||
import requireAgain from 'require-again';
|
||||
import logger from '../../../../../website/server/libs/api-v3/logger';
|
||||
import { TAVERN_ID } from '../../../../../website/server/models/group';
|
||||
|
||||
function defer () {
|
||||
let resolve;
|
||||
@@ -137,6 +138,23 @@ describe('emails', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getGroupUrl', () => {
|
||||
it('returns correct url if group is the tavern', () => {
|
||||
let getGroupUrl = require(pathToEmailLib).getGroupUrl;
|
||||
expect(getGroupUrl({_id: TAVERN_ID, type: 'guild'})).to.eql('/#/options/groups/tavern');
|
||||
});
|
||||
|
||||
it('returns correct url if group is a guild', () => {
|
||||
let getGroupUrl = require(pathToEmailLib).getGroupUrl;
|
||||
expect(getGroupUrl({_id: 'random _id', type: 'guild'})).to.eql('/#/options/groups/guilds/random _id');
|
||||
});
|
||||
|
||||
it('returns correct url if group is a party', () => {
|
||||
let getGroupUrl = require(pathToEmailLib).getGroupUrl;
|
||||
expect(getGroupUrl({_id: 'random _id', type: 'party'})).to.eql('party');
|
||||
});
|
||||
});
|
||||
|
||||
describe('sendTxnEmail', () => {
|
||||
beforeEach(() => {
|
||||
sandbox.stub(request, 'post');
|
||||
|
||||
Reference in New Issue
Block a user