-
Notifications
You must be signed in to change notification settings - Fork 87
/
event-helper.ts
36 lines (33 loc) · 945 Bytes
/
event-helper.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { EventEnvelope } from '@boostercloud/framework-types'
import { random, date } from 'faker'
export function createMockEventEnvelop(): EventEnvelope {
return createMockEventEnvelopForEntity(random.word(), random.uuid())
}
export function createMockEventEnvelopForEntity(entityTypeName: string, entityID: string): EventEnvelope {
return {
kind: 'event',
entityID: entityID,
entityTypeName: entityTypeName,
value: {
id: random.uuid(),
},
createdAt: date.past().toISOString(),
requestID: random.uuid(),
typeName: random.word(),
version: random.number(),
}
}
export function createMockSnapshot(): EventEnvelope {
return {
kind: 'snapshot',
entityID: random.uuid(),
entityTypeName: random.word(),
value: {
id: random.uuid(),
},
createdAt: date.past().toISOString(),
requestID: random.uuid(),
typeName: random.word(),
version: random.number(),
}
}