Skip to content

Commit

Permalink
Merge branch 'dev_feat/multiple_files_in_one_msg' into feat/multiple_…
Browse files Browse the repository at this point in the history
…files_in_one_msg
  • Loading branch information
abhipatel0211 committed Oct 26, 2024
2 parents 11e6002 + 945a224 commit c060422
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions apps/meteor/tests/mocks/data/subscriptions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { faker } from '@faker-js/faker';

export function mockSubscription() {
const data: Record<string, any> = {
_id: faker.string.uuid(),
rid: faker.string.uuid(),
name: faker.person.firstName(),
t: 'd',
alert: true,
E2EKey: faker.datatype.boolean() ? faker.string.uuid() : undefined,
E2ESuggestedKey: faker.datatype.boolean() ? faker.string.uuid() : undefined,
oldRoomKeys: faker.datatype.boolean() ? generateOldKeys() : undefined,
u: {
_id: faker.person.firstName(),
},
};

return data;
}

function generateOldKeys() {
const amount = faker.number.int({ min: 1, max: 10 });
const oldRoomKeys = [];
for (let i = 0; i < amount; i++) {
oldRoomKeys.push({
E2EKey: faker.string.uuid(),
ts: new Date(),
e2eKeyId: faker.string.uuid().slice(12),
});
}
return oldRoomKeys;
}

export function generateMultipleSubs(amount: number) {
const subs = [];
for (let i = 0; i < amount; i++) {
subs.push(mockSubscription());
}
return subs;
}

0 comments on commit c060422

Please sign in to comment.