mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-15 05:37:22 +01:00
* Added initial bailey api
* wip
* implement new panel header
* Fixed lint
* add ability to mark notification as seen
* add notification count, remove top badge from user and add ability to mark multiple notifications as seen
* add support dismissall and mark all as read
* do not dismiss actionable notif
* mark as seen when menu is opened instead of closed
* implement ordering, list of actionable notifications
* add groups messages and fix badges count
* add notifications for received cards
* send card received notification to target not sender
* rename notificaion field
* fix integration tests
* mark cards notifications as read and update tests
* add mystery items notifications
* add unallocated stats points notifications
* fix linting
* simplify code
* refactoring and fixes
* fix dropdown opening
* start splitting notifications into their own component
* add notifications for inbox messages
* fix unit tests
* fix default buttons styles
* add initial bailey support
* add title and tests to new stuff notification
* add notification if a group task needs more work
* add tests and fixes for marking a task as needing more work
* make sure user._v is updated
* remove console.log
* notification: hover status and margins
* start styling notifications, add separate files and basic functionalities
* fix tests
* start adding mystery items notification
* wip card notification
* fix cards text
* initial implementation inbox messages
* initial implementation group messages
* disable inbox notifications until mobile is ready
* wip group chat messages
* finish mystery and card notifications
* add bailey notification and fix a lot of stuff
* start adding guilds and parties invitations
* misc invitation fixes
* fix lint issues
* remove old code and add key to notifications
* fix tests
* remove unused code
* add link for public guilds invite
* starts to implement needs work notification design and feature
* fixes to needs work, add group task approved notification
* finish needs work feature
* lots of fixes
* implement quest notification
* bailey fixes and static page
* routing fixes
* fixes # this.$store.dispatch(guilds:join, {groupId: group.id, type: party});
* read notifications on click
* chat notifications
* fix tests for chat notifications
* fix chat notification test
* fix tests
* fix tests (again)
* try awaiting
* remove only
* more sleep
* add bailey tests
* fix icons alignment
* fix issue with multiple points notifications
* remove merge code
* fix rejecting guild invitation
* make remove area bigger
* fix error with notifications and add migration
* fix migration
* fix typos
* add cleanup migration too
* notifications empty state, new counter color, fix marking messages as seen in guilds
* fixes
* add image and install correct packages
* fix mongoose version
* update bailey
* typo
* make sure chat is marked as read after other requests
100 lines
3.8 KiB
JavaScript
100 lines
3.8 KiB
JavaScript
import {
|
|
generateUser,
|
|
generateHabit,
|
|
generateDaily,
|
|
generateReward,
|
|
} from '../../../../helpers/api-integration/v3';
|
|
import common from '../../../../../website/common';
|
|
import { v4 as generateUUID } from 'uuid';
|
|
|
|
describe('GET /user/anonymized', () => {
|
|
let user;
|
|
let endpoint = '/user/anonymized';
|
|
|
|
before(async () => {
|
|
user = await generateUser();
|
|
await user.update({
|
|
newMessages: ['some', 'new', 'messages'],
|
|
'profile.name': 'profile',
|
|
'purchased.plan': 'purchased plan',
|
|
contributor: 'contributor',
|
|
invitations: 'invitations',
|
|
'items.special.nyeReceived': 'some',
|
|
'items.special.valentineReceived': 'some',
|
|
webhooks: [{url: 'https://somurl.com'}],
|
|
'achievements.challenges': 'some',
|
|
'inbox.messages': [{ text: 'some text' }],
|
|
tags: [{ name: 'some name', challenge: 'some challenge' }],
|
|
notifications: [],
|
|
});
|
|
|
|
await generateHabit({ userId: user._id });
|
|
await generateHabit({ userId: user._id, text: generateUUID() });
|
|
let daily = await generateDaily({ userId: user._id, checklist: [{ completed: false, text: 'this-text' }] });
|
|
expect(daily.checklist[0].text.substr(0, 5)).to.not.eql('item ');
|
|
await generateReward({ userId: user._id, text: 'some text 4' });
|
|
|
|
expect(user.newMessages).to.exist;
|
|
expect(user.profile).to.exist;
|
|
expect(user.purchased.plan).to.exist;
|
|
expect(user.contributor).to.exist;
|
|
expect(user.invitations).to.exist;
|
|
expect(user.items.special.nyeReceived).to.exist;
|
|
expect(user.items.special.valentineReceived).to.exist;
|
|
expect(user.webhooks).to.exist;
|
|
expect(user.achievements.challenges).to.exist;
|
|
expect(user.inbox.messages[0].text).to.exist;
|
|
expect(user.inbox.messages[0].text).to.not.eql('inbox message text');
|
|
expect(user.tags[0].name).to.exist;
|
|
expect(user.tags[0].name).to.not.eql('tag');
|
|
expect(user.tags[0].challenge).to.not.eql('challenge');
|
|
});
|
|
|
|
it('returns the authenticated user', async () => {
|
|
let returnedUser = await user.get(endpoint);
|
|
returnedUser = returnedUser.user;
|
|
expect(returnedUser._id).to.equal(user._id);
|
|
});
|
|
|
|
it('does not return private paths (and apiToken)', async () => {
|
|
let returnedUser = await user.get(endpoint);
|
|
let tasks2 = returnedUser.tasks;
|
|
returnedUser = returnedUser.user;
|
|
expect(returnedUser.auth.local).to.not.exist;
|
|
expect(returnedUser.apiToken).to.not.exist;
|
|
expect(returnedUser.stats.maxHealth).to.eql(common.maxHealth);
|
|
expect(returnedUser.stats.toNextLevel).to.eql(common.tnl(user.stats.lvl));
|
|
expect(returnedUser.stats.maxMP).to.eql(30); // TODO why 30?
|
|
expect(returnedUser.newMessages).to.not.exist;
|
|
expect(returnedUser.notifications).to.not.exist;
|
|
expect(returnedUser.profile).to.not.exist;
|
|
expect(returnedUser.purchased.plan).to.not.exist;
|
|
expect(returnedUser.contributor).to.not.exist;
|
|
expect(returnedUser.invitations).to.not.exist;
|
|
expect(returnedUser.items.special.nyeReceived).to.not.exist;
|
|
expect(returnedUser.items.special.valentineReceived).to.not.exist;
|
|
expect(returnedUser.webhooks).to.not.exist;
|
|
expect(returnedUser.achievements.challenges).to.not.exist;
|
|
_.forEach(returnedUser.inbox.messages, (msg) => {
|
|
expect(msg.text).to.eql('inbox message text');
|
|
});
|
|
_.forEach(returnedUser.tags, (tag) => {
|
|
expect(tag.name).to.eql('tag');
|
|
expect(tag.challenge).to.eql('challenge');
|
|
});
|
|
// tasks
|
|
expect(tasks2).to.exist;
|
|
expect(tasks2.length).to.eql(5);
|
|
expect(tasks2[0].checklist).to.exist;
|
|
_.forEach(tasks2, (task) => {
|
|
expect(task.text).to.eql('task text');
|
|
expect(task.notes).to.eql('task notes');
|
|
if (task.checklist) {
|
|
_.forEach(task.checklist, (c) => {
|
|
expect(c.text.substr(0, 5)).to.eql('item ');
|
|
});
|
|
}
|
|
});
|
|
});
|
|
});
|