2015-11-20 02:27:39 +00:00
|
|
|
let shared = require('../../common/script/index.js');
|
2015-08-12 13:36:57 +00:00
|
|
|
|
2015-11-20 02:27:39 +00:00
|
|
|
describe('user.ops', () => {
|
|
|
|
|
let user;
|
2015-08-12 13:36:57 +00:00
|
|
|
|
2015-11-20 02:27:39 +00:00
|
|
|
beforeEach(() => {
|
2015-08-12 13:36:57 +00:00
|
|
|
user = {
|
|
|
|
|
items: {
|
|
|
|
|
gear: { },
|
2015-11-20 02:27:39 +00:00
|
|
|
special: { },
|
2015-08-12 13:36:57 +00:00
|
|
|
},
|
|
|
|
|
achievements: { },
|
2015-11-20 02:27:39 +00:00
|
|
|
flags: { },
|
2015-08-12 13:36:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
shared.wrap(user);
|
|
|
|
|
});
|
|
|
|
|
|
2015-11-20 02:27:39 +00:00
|
|
|
describe('readCard', () => {
|
|
|
|
|
it('removes card from invitation array', () => {
|
2015-08-12 13:36:57 +00:00
|
|
|
user.items.special.valentineReceived = ['Leslie'];
|
2015-08-14 00:55:13 +00:00
|
|
|
user.ops.readCard({ params: { cardType: 'valentine' } });
|
2015-08-12 13:36:57 +00:00
|
|
|
|
|
|
|
|
expect(user.items.special.valentineReceived).to.be.empty;
|
|
|
|
|
});
|
|
|
|
|
|
2015-11-20 02:27:39 +00:00
|
|
|
it('removes the first card from invitation array', () => {
|
2015-08-12 13:36:57 +00:00
|
|
|
user.items.special.valentineReceived = ['Leslie', 'Vicky'];
|
2015-08-14 00:55:13 +00:00
|
|
|
user.ops.readCard({ params: { cardType: 'valentine' } });
|
2015-08-12 13:36:57 +00:00
|
|
|
|
|
|
|
|
expect(user.items.special.valentineReceived).to.eql(['Vicky']);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|