mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
35 lines
838 B
JavaScript
35 lines
838 B
JavaScript
let shared = require('../../common/script/index.js');
|
|
|
|
describe('user.ops', () => {
|
|
let user;
|
|
|
|
beforeEach(() => {
|
|
user = {
|
|
items: {
|
|
gear: { },
|
|
special: { },
|
|
},
|
|
achievements: { },
|
|
flags: { },
|
|
};
|
|
|
|
shared.wrap(user);
|
|
});
|
|
|
|
describe('readCard', () => {
|
|
it('removes card from invitation array', () => {
|
|
user.items.special.valentineReceived = ['Leslie'];
|
|
user.ops.readCard({ params: { cardType: 'valentine' } });
|
|
|
|
expect(user.items.special.valentineReceived).to.be.empty;
|
|
});
|
|
|
|
it('removes the first card from invitation array', () => {
|
|
user.items.special.valentineReceived = ['Leslie', 'Vicky'];
|
|
user.ops.readCard({ params: { cardType: 'valentine' } });
|
|
|
|
expect(user.items.special.valentineReceived).to.eql(['Vicky']);
|
|
});
|
|
});
|
|
});
|