added tests to cover internal data checks

no ref
-tests didn't cover imported data escape
-tests didn't cover internal data escape
This commit is contained in:
Steve Larson 2023-02-01 17:40:29 -06:00
parent 3186323663
commit 855bcb8613

View File

@ -53,6 +53,26 @@ describe('MentionSendingService', function () {
sinon.assert.notCalled(stub);
});
it('Ignores if importing data', async function () {
const service = new MentionSendingService({
isEnabled: () => true
});
const stub = sinon.stub(service, 'sendAll');
let options = {importing: true};
await service.sendForPost({}, options);
sinon.assert.notCalled(stub);
});
it('Ignores if internal context', async function () {
const service = new MentionSendingService({
isEnabled: () => true
});
const stub = sinon.stub(service, 'sendAll');
let options = {context: {internal: true}};
await service.sendForPost({}, options);
sinon.assert.notCalled(stub);
});
it('Ignores draft posts', async function () {
const service = new MentionSendingService({
isEnabled: () => true