(overrides)
| 15 | } |
| 16 | |
| 17 | export default function makeFakeComment (overrides) { |
| 18 | const comment = { |
| 19 | author: faker.name.findName(), |
| 20 | createdOn: Date.now(), |
| 21 | id: Id.makeId(), |
| 22 | modifiedOn: Date.now(), |
| 23 | postId: Id.makeId(), |
| 24 | published: true, |
| 25 | replyToId: Id.makeId(), |
| 26 | text: faker.lorem.paragraph(3), |
| 27 | source: { |
| 28 | ip: faker.internet.ip(), |
| 29 | browser: faker.internet.userAgent(), |
| 30 | referrer: faker.internet.url() |
| 31 | } |
| 32 | } |
| 33 | comment.hash = md5( |
| 34 | comment.text + |
| 35 | comment.published + |
| 36 | (comment.author || '') + |
| 37 | (comment.postId || '') + |
| 38 | (comment.replyToId || '') |
| 39 | ) |
| 40 | |
| 41 | return { |
| 42 | ...comment, |
| 43 | ...overrides |
| 44 | } |
| 45 | } |
no test coverage detected