| 1 | import { render } from '@react-email/components'; |
| 2 | import { describe, expect |
| 3 | |
| 4 | import ThreadAssigned from './templates/thread-assigned.js |
| 5 | import ThreadComment from './templates/thread-comment.js |
| 6 | import ThreadOpened from './templates/thread-opened.js |
| 7 | import ThreadReview from './templates/thread-review.js |
| 8 | import ThreadState from './templates/thread-state.js |
| 9 | |
| 10 | const plain = ( |
| 11 | render(element, { |
| 12 | |
| 13 | describe('thread emails', () |
| 14 | it('link to the thread and say why the reader got them', |
| 15 | const text = |
| 16 | expect(text).toContain |
| 17 | expect(text).toContain |
| 18 | expect(text).toContain |
| 19 | expect(text).toContain |
| 20 | expect( |
| 21 | await plain(<ThreadOpened |
| 22 | ).not.toContain( |
| 23 | }); |
| 24 | |
| 25 | it('name the file a review comment is on', |
| 26 | const props = |
| 27 | expect(await plain |
| 28 | 'bob commented:', |
| 29 | ); |
| 30 | expect( |
| 31 | await plain(<ThreadComment |
| 32 | ).toContain('bob commented on src/bell.tsx:' |
| 33 | }); |
| 34 | |
| 35 | it('state the verdict and how many line comments came with it', |
| 36 | const props = |
| 37 | const text = |
| 38 | expect(text).toContain |
| 39 | expect(text).toContain |
| 40 | 'bob requested changes on this pull request and left 2 comments.', |
| 41 | ); |
| 42 | expect( |
| 43 | await plain( |
| 44 | <ThreadReview |
| 45 | {...props} |
| 46 | state="approved" |
| 47 | commentCount={1} |
| 48 | body={null} |
| 49 | />, |
| 50 | ), |
| 51 | ).toContain('bob approved this pull request and left 1 comment.' |
| 52 | expect( |
| 53 | await plain( |
| 54 | <ThreadReview {...props |
| 55 | ), |
| 56 | ).toContain('bob reviewed this pull request.' |
| 57 | }); |
| 58 | |
| 59 | it('say "you" to the person assigned and name them to everyone else', |
| 60 | const props = |
| 61 | expect(await plain |
| 62 | 'bob assigned you to this issue.', |
| 63 | ); |
| 64 | expect( |
| 65 | await plain(<ThreadAssigned |
| 66 | ).toContain('bob assigned alice to this issue.' |
| 67 | }); |
| 68 | |
| 69 | it('show what happened to the thread', |
| 70 | const text = |
| 71 | expect(text).toContain |
| 72 | expect(text).toContain |
| 73 | }); |
| 74 | }); |