Merge branch 'develop' into party-chat-translations
This commit is contained in:
@@ -123,7 +123,8 @@ describe('GET /challenges/:challengeId/members', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('supports using req.query.lastId to get more members', async () => {
|
||||
it('supports using req.query.lastId to get more members', async function () {
|
||||
this.timeout(30000); // @TODO: times out after 8 seconds
|
||||
let group = await generateGroup(user, {type: 'party', name: generateUUID()});
|
||||
let challenge = await generateChallenge(user, group);
|
||||
|
||||
|
||||
@@ -142,7 +142,8 @@ describe('GET /groups/:groupId/members', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('supports using req.query.lastId to get more members', async () => {
|
||||
it('supports using req.query.lastId to get more members', async function () {
|
||||
this.timeout(30000); // @TODO: times out after 8 seconds
|
||||
let leader = await generateUser({balance: 4});
|
||||
let group = await generateGroup(leader, {type: 'guild', privacy: 'public', name: generateUUID()});
|
||||
|
||||
|
||||
@@ -632,6 +632,15 @@ describe('payments/index', () => {
|
||||
expect(user.sendMessage).to.be.calledWith(recipient, { receiverMsg: msg, senderMsg: msg });
|
||||
});
|
||||
|
||||
it('sends a message from purchaser to recipient wtih custom message', async () => {
|
||||
data.gift.message = 'giftmessage';
|
||||
|
||||
await api.buyGems(data);
|
||||
|
||||
const msg = `\`Hello recipient, sender has sent you 4 gems!\` ${data.gift.message}`;
|
||||
expect(user.sendMessage).to.be.calledWith(recipient, { receiverMsg: msg, senderMsg: msg });
|
||||
});
|
||||
|
||||
it('sends a push notification if user did not gift to self', async () => {
|
||||
await api.buyGems(data);
|
||||
expect(notifications.sendNotification).to.be.calledOnce;
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
import {shallow} from '@vue/test-utils';
|
||||
|
||||
import CategoryTags from 'client/components/categories/categoryTags.vue';
|
||||
|
||||
describe('Category Tags', () => {
|
||||
let wrapper;
|
||||
|
||||
beforeEach(function () {
|
||||
wrapper = shallow(CategoryTags, {
|
||||
propsData: {
|
||||
categories: [],
|
||||
},
|
||||
slots: {
|
||||
default: '<p>This is a slot.</p>',
|
||||
},
|
||||
mocks: {
|
||||
$t: (string) => string,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('displays a category', () => {
|
||||
wrapper.setProps({
|
||||
categories: [
|
||||
{
|
||||
name: 'test',
|
||||
},
|
||||
],
|
||||
});
|
||||
expect(wrapper.contains('.category-label')).to.eq(true);
|
||||
expect(wrapper.find('.category-label').text()).to.eq('test');
|
||||
});
|
||||
|
||||
it('displays a habitica official in purple', () => {
|
||||
wrapper.setProps({
|
||||
categories: [
|
||||
{
|
||||
name: 'habitica_official',
|
||||
},
|
||||
],
|
||||
});
|
||||
expect(wrapper.contains('.category-label-purple')).to.eq(true);
|
||||
expect(wrapper.find('.category-label').text()).to.eq('habitica_official');
|
||||
});
|
||||
|
||||
it('displays owner label', () => {
|
||||
wrapper.setProps({
|
||||
owner: true,
|
||||
});
|
||||
expect(wrapper.contains('.category-label-blue')).to.eq(true);
|
||||
expect(wrapper.find('.category-label').text()).to.eq('owned');
|
||||
});
|
||||
|
||||
it('displays member label', () => {
|
||||
wrapper.setProps({
|
||||
member: true,
|
||||
});
|
||||
expect(wrapper.contains('.category-label-green')).to.eq(true);
|
||||
expect(wrapper.find('.category-label').text()).to.eq('joined');
|
||||
});
|
||||
|
||||
it('displays additional content at the end', () => {
|
||||
expect(wrapper.find('p').text()).to.eq('This is a slot.');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,54 @@
|
||||
import {shallow} from '@vue/test-utils';
|
||||
|
||||
import SidebarSection from 'client/components/sidebarSection.vue';
|
||||
|
||||
describe('Sidebar Section', () => {
|
||||
let wrapper;
|
||||
|
||||
beforeEach(function () {
|
||||
wrapper = shallow(SidebarSection, {
|
||||
propsData: {
|
||||
title: 'Hello World',
|
||||
},
|
||||
slots: {
|
||||
default: '<p>This is a test.</p>',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('displays title', () => {
|
||||
expect(wrapper.find('h3').text()).to.eq('Hello World');
|
||||
});
|
||||
|
||||
it('displays contents', () => {
|
||||
expect(wrapper.find('.section-body').find('p').text()).to.eq('This is a test.');
|
||||
});
|
||||
|
||||
it('displays tooltip icon', () => {
|
||||
expect(wrapper.contains('.section-info')).to.eq(false);
|
||||
wrapper.setProps({tooltip: 'This is a test'});
|
||||
expect(wrapper.contains('.section-info')).to.eq(true);
|
||||
});
|
||||
|
||||
it('hides contents', () => {
|
||||
expect(wrapper.find('.section-body').element.style.display).to.not.eq('none');
|
||||
wrapper.find('.section-toggle').trigger('click');
|
||||
expect(wrapper.find('.section-body').element.style.display).to.eq('none');
|
||||
wrapper.find('.section-toggle').trigger('click');
|
||||
expect(wrapper.find('.section-body').element.style.display).to.not.eq('none');
|
||||
});
|
||||
|
||||
it('can hide contents by default', () => {
|
||||
wrapper = shallow(SidebarSection, {
|
||||
propsData: {
|
||||
title: 'Hello World',
|
||||
show: false,
|
||||
},
|
||||
slots: {
|
||||
default: '<p>This is a test.</p>',
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper.find('.section-body').element.style.display).to.eq('none');
|
||||
});
|
||||
});
|
||||
@@ -122,11 +122,10 @@ describe('common.fns.updateStats', () => {
|
||||
updateStats(user, {
|
||||
exp: 3000,
|
||||
});
|
||||
expect(user.addNotification).to.be.calledTwice; // once is for drops enabled
|
||||
expect(user.addNotification).to.be.calledWith('LEVELED_UP', {
|
||||
expect(user._tmp.leveledUp).to.eql([{
|
||||
initialLvl,
|
||||
newLvl: user.stats.lvl,
|
||||
});
|
||||
}]);
|
||||
});
|
||||
|
||||
it('add user notification when rebirth is enabled', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import buySpecialSpell from '../../../../website/common/script/ops/buy/buySpecialSpell';
|
||||
import {BuySpellOperation} from '../../../../website/common/script/ops/buy/buySpell';
|
||||
import {
|
||||
BadRequest,
|
||||
NotFound,
|
||||
@@ -15,6 +15,11 @@ describe('shared.ops.buySpecialSpell', () => {
|
||||
let user;
|
||||
let analytics = {track () {}};
|
||||
|
||||
function buySpecialSpell (_user, _req, _analytics) {
|
||||
const buyOp = new BuySpellOperation(_user, _req, _analytics);
|
||||
|
||||
return buyOp.purchase();
|
||||
}
|
||||
beforeEach(() => {
|
||||
user = generateUser();
|
||||
sinon.stub(analytics, 'track');
|
||||
Reference in New Issue
Block a user