<commit_before>import proxyquire from 'proxyquire';

export default proxyquire('../../src/notifications/notify-of-new-blogs', {
  'aws-sdk': {
    SNS: function SNS() {
      return {
        publish: function publish({ TargetArn, Subject, Message }, callback) {
          if (Subject.endsWith(' published a new blog post')) {
            callback(null, { MessageId: 1 });
          }

          if (Subject.endsWith(' new blog posts') && !Message.startsWith('Including:')) {
            callback(null, { MessageId: 2 });
          }

          if (Subject.endsWith(' new blog posts') && Message.startsWith('Including:')) {
            callback(null, { MessageId: 3 });
          }

          if (Subject.endsWith(' authors') && Message.startsWith('Written by')) {
            callback(null, { MessageId: 4 });
          }

          if (Subject.endsWith(' authors') && Message.startsWith('Including posts by')) {
            callback(null, { MessageId: 5 });
          }
        }
      };
    }
  }
}).default;<commit_msg>Split SNS mocks into working and not working in order to simulate errors with accessing amazon SNS<commit_after>import proxyquire from 'proxyquire';

export const notifyWorkingSNS = proxyquire('../../src/notifications/notify-of-new-blogs', {
  'aws-sdk': {
    SNS: function SNS() {
      return {
        publish: function publish({ TargetArn, Subject, Message }, callback) {
          if (Subject.endsWith(' published a new blog post')) {
            callback(null, { MessageId: 1 });
          }

          if (Subject.endsWith(' new blog posts') && !Message.startsWith('Including:')) {
            callback(null, { MessageId: 2 });
          }

          if (Subject.endsWith(' new blog posts') && Message.startsWith('Including:')) {
            callback(null, { MessageId: 3 });
          }

          if (Subject.endsWith(' authors') && Message.startsWith('Written by')) {
            callback(null, { MessageId: 4 });
          }

          if (Subject.endsWith(' authors') && Message.startsWith('Including posts by')) {
            callback(null, { MessageId: 5 });
          }
        }
      };
    }
  }
}).default;

export const notifyErroringSNS = proxyquire('../../src/notifications/notify-of-new-blogs', {
  'aws-sdk': {
    SNS: function SNS() {
      return {
        publish: function publish({ TargetArn, Subject, Message }, callback) {
          callback(new Error('Simulated Error'), null);
        }
      };
    }
  }
}).default;
{'fraction_non_alphanumeric': 0.1518578352180937, 'fraction_numerical': 0.004038772213247173, 'mean_word_length': 2.237908496732026, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5686176', 'n_tokens_mistral': 711, 'n_tokens_neox': 682, 'n_words': 167}