mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Renamed exposed _getEmailMemberRows in mega
no issue - Exposing internal methods out of the module is a non-standard practice. Adding `_` prefix allows to signal that this method is not for general use. - When mega is refactored into a proper class this method will become exposed anyways
This commit is contained in:
parent
f343e73c92
commit
b045112950
2 changed files with 7 additions and 6 deletions
|
@ -533,7 +533,8 @@ module.exports = {
|
||||||
retryFailedEmail,
|
retryFailedEmail,
|
||||||
sendTestEmail,
|
sendTestEmail,
|
||||||
handleUnsubscribeRequest,
|
handleUnsubscribeRequest,
|
||||||
partitionMembersBySegment // NOTE: only exposed for testing
|
// NOTE: below are only exposed for testing purposes
|
||||||
|
_partitionMembersBySegment: partitionMembersBySegment
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,7 +2,7 @@ const should = require('should');
|
||||||
const sinon = require('sinon');
|
const sinon = require('sinon');
|
||||||
const errors = require('@tryghost/errors');
|
const errors = require('@tryghost/errors');
|
||||||
|
|
||||||
const {addEmail, partitionMembersBySegment} = require('../../../../core/server/services/mega/mega');
|
const {addEmail, _partitionMembersBySegment} = require('../../../../core/server/services/mega/mega');
|
||||||
|
|
||||||
describe('MEGA', function () {
|
describe('MEGA', function () {
|
||||||
describe('addEmail', function () {
|
describe('addEmail', function () {
|
||||||
|
@ -49,7 +49,7 @@ describe('MEGA', function () {
|
||||||
}];
|
}];
|
||||||
const segments = [];
|
const segments = [];
|
||||||
|
|
||||||
const partitions = partitionMembersBySegment(members, segments);
|
const partitions = _partitionMembersBySegment(members, segments);
|
||||||
|
|
||||||
partitions.unsegmented.length.should.equal(3);
|
partitions.unsegmented.length.should.equal(3);
|
||||||
partitions.unsegmented[0].name.should.equal('Free Rish');
|
partitions.unsegmented[0].name.should.equal('Free Rish');
|
||||||
|
@ -68,7 +68,7 @@ describe('MEGA', function () {
|
||||||
}];
|
}];
|
||||||
const segments = ['status:free'];
|
const segments = ['status:free'];
|
||||||
|
|
||||||
const partitions = partitionMembersBySegment(members, segments);
|
const partitions = _partitionMembersBySegment(members, segments);
|
||||||
|
|
||||||
should.exist(partitions['status:free']);
|
should.exist(partitions['status:free']);
|
||||||
partitions['status:free'].length.should.equal(2);
|
partitions['status:free'].length.should.equal(2);
|
||||||
|
@ -93,7 +93,7 @@ describe('MEGA', function () {
|
||||||
}];
|
}];
|
||||||
const segments = ['status:free', 'status:-free'];
|
const segments = ['status:free', 'status:-free'];
|
||||||
|
|
||||||
const partitions = partitionMembersBySegment(members, segments);
|
const partitions = _partitionMembersBySegment(members, segments);
|
||||||
|
|
||||||
should.exist(partitions['status:free']);
|
should.exist(partitions['status:free']);
|
||||||
partitions['status:free'].length.should.equal(2);
|
partitions['status:free'].length.should.equal(2);
|
||||||
|
@ -113,7 +113,7 @@ describe('MEGA', function () {
|
||||||
const segments = ['not a valid segment'];
|
const segments = ['not a valid segment'];
|
||||||
|
|
||||||
should.throws(() => {
|
should.throws(() => {
|
||||||
partitionMembersBySegment(members, segments);
|
_partitionMembersBySegment(members, segments);
|
||||||
}, errors.ValidationError);
|
}, errors.ValidationError);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue