Add out of order mock test for read syncs

This commit is contained in:
Josh Perez 2023-08-29 17:51:24 -04:00 committed by GitHub
parent 1fef0ec208
commit ee9de52f9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 182 additions and 6 deletions

View file

@ -26,10 +26,10 @@ export type ViewSyncAttributesType = {
viewedAt: number;
};
const viewSyncs = new Map<string, ViewSyncAttributesType>();
const viewSyncs = new Map<number, ViewSyncAttributesType>();
function remove(sync: ViewSyncAttributesType): void {
viewSyncs.delete(sync.envelopeId);
viewSyncs.delete(sync.timestamp);
sync.removeFromMessageReceiverCache();
}
@ -68,7 +68,7 @@ export function forMessage(
}
export async function onSync(sync: ViewSyncAttributesType): Promise<void> {
viewSyncs.set(sync.envelopeId, sync);
viewSyncs.set(sync.timestamp, sync);
const logId = `ViewSyncs.onSync(timestamp=${sync.timestamp})`;