MCPcopy Create free account
hub / github.com/danielroe/hello-zero-nuxt / randomMessage

Function randomMessage

app/db/data/test-data.ts:23–39  ·  view source on GitHub ↗
(users: readonly User[], mediums: readonly Medium[])

Source from the content-addressed store, hash-verified

21]
22
23export function randomMessage(users: readonly User[], mediums: readonly Medium[]): Message {
24 const id = randID()
25 const mediumID = mediums[randInt(mediums.length)]!.id
26 const timestamp = randBetween(1727395200000, new Date().getTime())
27 const isRequest = randInt(10) <= 6
28 const messages = isRequest ? requests : replies
29 const senders = users.filter(u => u.partner === !isRequest)
30 const senderID = senders[randInt(senders.length)]!.id
31
32 return {
33 id,
34 senderID,
35 mediumID,
36 body: messages[randInt(messages.length)]!,
37 timestamp,
38 }
39}

Callers

nothing calls this directly

Calls 3

randIDFunction · 0.85
randIntFunction · 0.85
randBetweenFunction · 0.85

Tested by

no test coverage detected