mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Remove extraneous anonymous function.
This commit is contained in:
@@ -1,54 +1,50 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
var app, payments;
|
||||
var app, payments;
|
||||
|
||||
payments = require("../../website/src/controllers/payments");
|
||||
payments = require("../../website/src/controllers/payments");
|
||||
|
||||
app = require("../../website/src/server");
|
||||
app = require("../../website/src/server");
|
||||
|
||||
describe("Subscriptions", function() {
|
||||
before(function(done) {
|
||||
return registerNewUser(done, true);
|
||||
});
|
||||
return it("Handles unsubscription", function(done) {
|
||||
var cron;
|
||||
cron = function() {
|
||||
user.lastCron = moment().subtract(1, "d");
|
||||
return user.fns.cron();
|
||||
};
|
||||
expect(user.purchased.plan.customerId).to.not.exist;
|
||||
payments.createSubscription({
|
||||
user: user,
|
||||
customerId: "123",
|
||||
paymentMethod: "Stripe",
|
||||
sub: {
|
||||
key: 'basic_6mo'
|
||||
}
|
||||
});
|
||||
expect(user.purchased.plan.customerId).to.exist;
|
||||
shared.wrap(user);
|
||||
cron();
|
||||
expect(user.purchased.plan.customerId).to.exist;
|
||||
payments.cancelSubscription({
|
||||
user: user
|
||||
});
|
||||
cron();
|
||||
expect(user.purchased.plan.customerId).to.exist;
|
||||
expect(user.purchased.plan.dateTerminated).to.exist;
|
||||
user.purchased.plan.dateTerminated = moment().subtract(2, "d");
|
||||
cron();
|
||||
expect(user.purchased.plan.customerId).to.not.exist;
|
||||
payments.createSubscription({
|
||||
user: user,
|
||||
customerId: "123",
|
||||
paymentMethod: "Stripe",
|
||||
sub: {
|
||||
key: 'basic_6mo'
|
||||
}
|
||||
});
|
||||
expect(user.purchased.plan.dateTerminated).to.not.exist;
|
||||
return done();
|
||||
});
|
||||
describe("Subscriptions", function() {
|
||||
before(function(done) {
|
||||
return registerNewUser(done, true);
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
return it("Handles unsubscription", function(done) {
|
||||
var cron;
|
||||
cron = function() {
|
||||
user.lastCron = moment().subtract(1, "d");
|
||||
return user.fns.cron();
|
||||
};
|
||||
expect(user.purchased.plan.customerId).to.not.exist;
|
||||
payments.createSubscription({
|
||||
user: user,
|
||||
customerId: "123",
|
||||
paymentMethod: "Stripe",
|
||||
sub: {
|
||||
key: 'basic_6mo'
|
||||
}
|
||||
});
|
||||
expect(user.purchased.plan.customerId).to.exist;
|
||||
shared.wrap(user);
|
||||
cron();
|
||||
expect(user.purchased.plan.customerId).to.exist;
|
||||
payments.cancelSubscription({
|
||||
user: user
|
||||
});
|
||||
cron();
|
||||
expect(user.purchased.plan.customerId).to.exist;
|
||||
expect(user.purchased.plan.dateTerminated).to.exist;
|
||||
user.purchased.plan.dateTerminated = moment().subtract(2, "d");
|
||||
cron();
|
||||
expect(user.purchased.plan.customerId).to.not.exist;
|
||||
payments.createSubscription({
|
||||
user: user,
|
||||
customerId: "123",
|
||||
paymentMethod: "Stripe",
|
||||
sub: {
|
||||
key: 'basic_6mo'
|
||||
}
|
||||
});
|
||||
expect(user.purchased.plan.dateTerminated).to.not.exist;
|
||||
return done();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user