0
Fork 0
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:
Naz 2021-07-14 18:56:30 +04:00
parent f343e73c92
commit b045112950
2 changed files with 7 additions and 6 deletions

View file

@ -533,7 +533,8 @@ module.exports = {
retryFailedEmail,
sendTestEmail,
handleUnsubscribeRequest,
partitionMembersBySegment // NOTE: only exposed for testing
// NOTE: below are only exposed for testing purposes
_partitionMembersBySegment: partitionMembersBySegment
};
/**

View file

@ -2,7 +2,7 @@ const should = require('should');
const sinon = require('sinon');
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('addEmail', function () {
@ -49,7 +49,7 @@ describe('MEGA', function () {
}];
const segments = [];
const partitions = partitionMembersBySegment(members, segments);
const partitions = _partitionMembersBySegment(members, segments);
partitions.unsegmented.length.should.equal(3);
partitions.unsegmented[0].name.should.equal('Free Rish');
@ -68,7 +68,7 @@ describe('MEGA', function () {
}];
const segments = ['status:free'];
const partitions = partitionMembersBySegment(members, segments);
const partitions = _partitionMembersBySegment(members, segments);
should.exist(partitions['status:free']);
partitions['status:free'].length.should.equal(2);
@ -93,7 +93,7 @@ describe('MEGA', function () {
}];
const segments = ['status:free', 'status:-free'];
const partitions = partitionMembersBySegment(members, segments);
const partitions = _partitionMembersBySegment(members, segments);
should.exist(partitions['status:free']);
partitions['status:free'].length.should.equal(2);
@ -113,7 +113,7 @@ describe('MEGA', function () {
const segments = ['not a valid segment'];
should.throws(() => {
partitionMembersBySegment(members, segments);
_partitionMembersBySegment(members, segments);
}, errors.ValidationError);
});
});