MCPcopy
hub / github.com/dev-mastery/comments-api / makeFakeComment

Function makeFakeComment

__test__/fixtures/comment.js:17–45  ·  view source on GitHub ↗
(overrides)

Source from the content-addressed store, hash-verified

15}
16
17export 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}

Callers 12

comment.spec.jsFile · 0.85
akismet.spec.jsFile · 0.85
e2e.spec.jsFile · 0.85

Calls 1

md5Function · 0.70

Tested by

no test coverage detected