formatter.test.js 760 B

123456789101112131415161718192021
  1. const rewire = require('rewire');
  2. const formatter = rewire('../index');
  3. describe('formatForTwitter', () => {
  4. it('should format a message for Twitter', async () => {
  5. const message = 'Hello, Twitter!';
  6. const formatForTwitter = formatter.__get__('formatForTwitter');
  7. const result = await formatForTwitter(message);
  8. expect(result).toBe('message formatted for twitter: Hello, Twitter!');
  9. });
  10. });
  11. describe('formatForLinkedin', () => {
  12. it('should format a message for LinkedIn', async () => {
  13. const message = 'Hello, LinkedIn!';
  14. const formatForLinkedin = formatter.__get__('formatForLinkedin');
  15. const result = await formatForLinkedin(message);
  16. expect(result).toBe('message formatted for linkedin: Hello, LinkedIn!');
  17. });
  18. });