mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 22:43:30 +03:00
Fixed isStripeEnabled usage in import validator tests
refs c63a0e6826
- Reason for the fix same as in the referenced commit
This commit is contained in:
parent
c63a0e6826
commit
060b0e759b
@ -49,7 +49,7 @@ export default Service.extend({
|
||||
validationResults.push(new MemberImportError('Stripe customer IDs exist in the data, but no stripe account is connected.'));
|
||||
}
|
||||
|
||||
if (stripeLocalValidation === true) {
|
||||
if (stripeLocalValidation === true && this.membersUtils.isStripeEnabled) {
|
||||
let stripeSeverValidation = await this._checkStripeServer(validatedSet);
|
||||
if (stripeSeverValidation !== true) {
|
||||
validationResults.push(new MemberImportError('Stripe customer IDs exist in the data, but we could not find such customer in connected Stripe account'));
|
||||
@ -86,10 +86,9 @@ export default Service.extend({
|
||||
},
|
||||
|
||||
_checkStripeLocal(validatedSet) {
|
||||
const isStripeConfigured = this.membersUtils.isStripeEnabled;
|
||||
let result = true;
|
||||
|
||||
if (!isStripeConfigured) {
|
||||
if (!this.membersUtils.isStripeEnabled) {
|
||||
validatedSet.forEach((member) => {
|
||||
if (member.stripe_customer_id) {
|
||||
result = false;
|
||||
|
@ -5,7 +5,7 @@ import {expect} from 'chai';
|
||||
import {setupTest} from 'ember-mocha';
|
||||
|
||||
let MembersUtilsStub = Service.extend({
|
||||
isStripeEnabled: () => (true)
|
||||
isStripeEnabled: true
|
||||
});
|
||||
|
||||
describe('Integration: Service: member-import-validator', function () {
|
||||
@ -39,7 +39,7 @@ describe('Integration: Service: member-import-validator', function () {
|
||||
const result = await service.check([]);
|
||||
|
||||
expect(result.length).to.equal(1);
|
||||
expect(result[0].message).to.equal('No data present in selected file.');
|
||||
expect(result[0].message).to.equal('File is empty, nothing to import. Please select a different file.');
|
||||
});
|
||||
|
||||
it('returns validation error for data with invalid email', async function () {
|
||||
@ -56,7 +56,7 @@ describe('Integration: Service: member-import-validator', function () {
|
||||
|
||||
it('returns validation error for data with stripe_customer_id but no connected Stripe', async function () {
|
||||
this.owner.register('service:membersUtils', Service.extend({
|
||||
isStripeEnabled: () => (false)
|
||||
isStripeEnabled: false
|
||||
}));
|
||||
|
||||
let service = this.owner.lookup('service:member-import-validator');
|
||||
|
Loading…
Reference in New Issue
Block a user