Skip to content
This repository was archived by the owner on Dec 21, 2021. It is now read-only.

Commit 13f3d4e

Browse files
committed
types: Fix Encryption test types.
1 parent d9d1771 commit 13f3d4e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

test/integration/Encryption.test.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ describeRepeats('decryption', () => {
220220
it('changing group key injects group key into next stream message', async () => {
221221
const done = Defer()
222222
const msgs = [Msg(), Msg(), Msg()]
223-
const received = []
223+
const received: any[] = []
224224
await grantSubscriberPermissions()
225225
// subscribe without knowing the group key to decrypt stream messages
226226
const sub = await subscriber.subscribe({
@@ -291,6 +291,7 @@ describeRepeats('decryption', () => {
291291

292292
it('errors if setting group key for no stream', async () => {
293293
expect(async () => (
294+
// @ts-expect-error
294295
publisher.setNextGroupKey(undefined, GroupKey.generate())
295296
)).rejects.toThrow('streamId')
296297
})
@@ -366,7 +367,7 @@ describeRepeats('decryption', () => {
366367
async function testSub(testStream: Stream) {
367368
const NUM_MESSAGES = 5
368369
const done = Defer()
369-
const received = []
370+
const received: any = []
370371
await grantSubscriberPermissions({ stream: testStream })
371372
const sub = await subscriber.subscribe({
372373
stream: testStream.id,
@@ -444,7 +445,7 @@ describeRepeats('decryption', () => {
444445
async function testSub(testStream: Stream) {
445446
const NUM_MESSAGES = 5
446447
const done = Defer()
447-
const received = []
448+
const received: any[] = []
448449
await grantSubscriberPermissions({ stream: testStream })
449450
const sub = await subscriber.subscribe({
450451
stream: testStream.id,
@@ -597,11 +598,12 @@ describeRepeats('decryption', () => {
597598
const { parse } = subscriber.connection
598599
subscriber.connection.parse = (...args) => {
599600
const msg = parse.call(subscriber.connection, ...args)
600-
if (!msg.streamMessage) {
601+
if (!('streamMessage' in msg)) {
601602
return msg
602603
}
603604

604605
if (count === BAD_INDEX) {
606+
// @ts-expect-error
605607
msg.streamMessage.groupKeyId = 'badgroupkey'
606608
}
607609

@@ -676,15 +678,15 @@ describeRepeats('decryption', () => {
676678
stream: stream.id,
677679
})
678680

679-
const errs = []
680-
const onSubError = jest.fn((err) => {
681+
const errs: Error[] = []
682+
const onSubError = jest.fn((err: Error) => {
681683
errs.push(err)
682684
throw err // this should trigger unsub
683685
})
684686

685687
sub.on('error', onSubError)
686688

687-
const received = []
689+
const received: any[] = []
688690
// Publish after subscribed
689691
let count = 0
690692
const gotMessages = Defer()

0 commit comments

Comments
 (0)