Skip to content

Commit

Permalink
remove buyMysterySet confirm request
Browse files Browse the repository at this point in the history
  • Loading branch information
negue committed Jan 28, 2018
1 parent e7917b4 commit 86bfe36
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 20 deletions.
15 changes: 0 additions & 15 deletions test/common/ops/buy/buyMysterySet.js
Expand Up @@ -14,7 +14,6 @@ import i18n from '../../../../website/common/script/i18n';
describe('shared.ops.buyMysterySet', () => {
let user;
let analytics = {track () {}};
global.window = {confirm () {}};

beforeEach(() => {
user = generateUser({
Expand All @@ -27,12 +26,10 @@ describe('shared.ops.buyMysterySet', () => {
},
});
sinon.stub(analytics, 'track');
sinon.stub(global.window, 'confirm', () => true);
});

afterEach(() => {
analytics.track.restore();
global.window.confirm.restore();
});

context('Mystery Sets', () => {
Expand Down Expand Up @@ -80,17 +77,6 @@ describe('shared.ops.buyMysterySet', () => {
});

context('successful purchases', () => {
it('does not buy without confirmation', () => {
global.window.confirm.restore();
sinon.stub(global.window, 'confirm', () => false);

user.purchased.plan.consecutive.trinkets = 1;
buyMysterySet(user, {params: {key: '301404'}}, analytics);

expect(user.purchased.plan.consecutive.trinkets).to.eql(1);
expect(user.items.gear.owned).not.to.have.property('weapon_mystery_301404');
});

it('buys Steampunk Accessories Set', () => {
user.purchased.plan.consecutive.trinkets = 1;
buyMysterySet(user, {params: {key: '301404'}}, analytics);
Expand All @@ -102,7 +88,6 @@ describe('shared.ops.buyMysterySet', () => {
expect(user.items.gear.owned).to.have.property('head_mystery_301404', true);
expect(user.items.gear.owned).to.have.property('eyewear_mystery_301404', true);
expect(analytics.track).to.be.called;
expect(global.window.confirm).to.be.called;
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion website/client/store/actions/shops.js
Expand Up @@ -82,7 +82,7 @@ export function purchase (store, params) {

export function purchaseMysterySet (store, params) {
const user = store.state.user.data;
let opResult = buyOp(user, {params, noConfirm: true, type: 'mystery'});
let opResult = buyOp(user, {params, type: 'mystery'});

return {
result: opResult,
Expand Down
4 changes: 0 additions & 4 deletions website/common/script/ops/buy/buyMysterySet.js
Expand Up @@ -23,10 +23,6 @@ module.exports = function buyMysterySet (user, req = {}, analytics) {
throw new NotFound(i18n.t('mysterySetNotFound', req.language));
}

if (!req.noConfirm && window.confirm) { // TODO move to client
if (!window.confirm(i18n.t('hourglassBuyEquipSetConfirm'))) return;
}

each(mysterySet.items, item => {
user.items.gear.owned[item.key] = true;
if (analytics) {
Expand Down

0 comments on commit 86bfe36

Please sign in to comment.