@signalapp/mock-server
Advanced tools
Comparing version 2.17.0 to 2.18.0
{ | ||
"name": "@signalapp/mock-server", | ||
"version": "2.17.0", | ||
"version": "2.18.0", | ||
"description": "Mock Signal Server for writing tests", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -96,2 +96,9 @@ /// <reference types="node" /> | ||
}>; | ||
export type ReceiptQueueEntry = Readonly<{ | ||
source: Device; | ||
uuidKind: UUIDKind; | ||
envelopeType: EnvelopeType; | ||
receiptMessage: Proto.IReceiptMessage; | ||
content: Proto.IContent; | ||
}>; | ||
export type StoryQueueEntry = Readonly<{ | ||
@@ -140,2 +147,3 @@ source: Device; | ||
private readonly messageQueue; | ||
private readonly receiptQueue; | ||
private readonly storyQueue; | ||
@@ -195,2 +203,3 @@ private readonly syncMessageQueue; | ||
waitForMessage(): Promise<MessageQueueEntry>; | ||
waitForReceipt(): Promise<ReceiptQueueEntry>; | ||
waitForStory(): Promise<StoryQueueEntry>; | ||
@@ -205,2 +214,3 @@ waitForSyncMessage(predicate?: ((entry: SyncMessageQueueEntry) => boolean)): Promise<SyncMessageQueueEntry>; | ||
private handleDataMessage; | ||
private handleReceiptMessage; | ||
private handleStoryMessage; | ||
@@ -207,0 +217,0 @@ private encrypt; |
@@ -176,2 +176,3 @@ "use strict"; | ||
messageQueue = new util_1.PromiseQueue(); | ||
receiptQueue = new util_1.PromiseQueue(); | ||
storyQueue = new util_1.PromiseQueue(); | ||
@@ -492,2 +493,5 @@ syncMessageQueue = new util_1.PromiseQueue(); | ||
} | ||
else if (content.receiptMessage) { | ||
this.handleReceiptMessage(unsealedSource, uuidKind, unsealedType, content); | ||
} | ||
else { | ||
@@ -717,2 +721,5 @@ handled = false; | ||
} | ||
async waitForReceipt() { | ||
return this.receiptQueue.shift(); | ||
} | ||
async waitForStory() { | ||
@@ -869,2 +876,13 @@ return this.storyQueue.shift(); | ||
} | ||
handleReceiptMessage(source, uuidKind, envelopeType, content) { | ||
const { receiptMessage } = content; | ||
assert_1.default.ok(receiptMessage, 'receiptMessage must be present'); | ||
this.receiptQueue.push({ | ||
source, | ||
uuidKind, | ||
envelopeType, | ||
receiptMessage, | ||
content, | ||
}); | ||
} | ||
handleStoryMessage(source, uuidKind, envelopeType, content) { | ||
@@ -871,0 +889,0 @@ const { storyMessage } = content; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3403260
62360